├── .gitignore ├── AUTHORS ├── CODINGSTYLE ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── NEWS ├── PACKAGE_VERSION ├── README ├── acinclude.m4 ├── autogen.sh ├── build_debs.sh.in ├── conf ├── Makefile.am └── httpd │ ├── Makefile.am │ ├── README.httpd │ ├── hls.conf │ ├── hls.passwd │ └── hls_methods.pl ├── configure.ac ├── debian ├── Makefile.am ├── changelog.src ├── control.src ├── copyright ├── rules └── source │ ├── Makefile.am │ └── format ├── docs ├── Makefile.am ├── glasscoder-ipc.xml ├── glasscoder.xml.in ├── glasscommander.xml └── glassgui.xml ├── get_distro.pl ├── get_target.sh ├── glasscoder.spec.in ├── icons ├── Makefile.am ├── back.xpm ├── glasscoder-16x16.png ├── glasscoder-16x16.xpm ├── glasscoder-22x22.png ├── glasscoder-48x48.png ├── minussign.xpm └── plussign.xpm ├── link_common.sh ├── plugins ├── Makefile.am ├── install_pypad.sh.in ├── pypad_glasscoder.exemplar └── pypad_glasscoder.py ├── src ├── Makefile.am ├── common │ ├── Makefile.am │ ├── asihpi.cpp │ ├── asihpi.h │ ├── audiodevice.cpp │ ├── audiodevice.h │ ├── cmdswitch.cpp │ ├── cmdswitch.h │ ├── codec.cpp │ ├── codec.h │ ├── codecdialog.cpp │ ├── codecdialog.h │ ├── codeviewer.cpp │ ├── codeviewer.h │ ├── combobox.cpp │ ├── combobox.h │ ├── connector.cpp │ ├── connector.h │ ├── glasslimits.h │ ├── guiapplication.cpp │ ├── guiapplication.h │ ├── hpiinputlistview.cpp │ ├── hpiinputlistview.h │ ├── hpiwidget.cpp │ ├── hpiwidget.h │ ├── logging.cpp │ ├── logging.h │ ├── messagewidget.cpp │ ├── messagewidget.h │ ├── metaevent.cpp │ ├── metaevent.h │ ├── paths.h.in │ ├── profile.cpp │ ├── profile.h │ ├── ringbuffer.cpp │ ├── ringbuffer.h │ ├── segmeter.cpp │ ├── segmeter.h │ ├── serverdialog.cpp │ ├── serverdialog.h │ ├── sourcedialog.cpp │ ├── sourcedialog.h │ ├── spinbox.cpp │ ├── spinbox.h │ ├── statuswidget.cpp │ ├── statuswidget.h │ ├── stereometer.cpp │ ├── stereometer.h │ ├── streamdialog.cpp │ └── streamdialog.h ├── glasscoder │ ├── Makefile.am │ ├── alsadevice.cpp │ ├── alsadevice.h │ ├── asihpidevice.cpp │ ├── asihpidevice.h │ ├── audiodevicefactory.cpp │ ├── audiodevicefactory.h │ ├── codecfactory.cpp │ ├── codecfactory.h │ ├── config.cpp │ ├── config.h │ ├── connectorfactory.cpp │ ├── connectorfactory.h │ ├── fdkcodec.cpp │ ├── fdkcodec.h │ ├── filearchiveconnector.cpp │ ├── filearchiveconnector.h │ ├── fileconnector.cpp │ ├── fileconnector.h │ ├── filedevice.cpp │ ├── filedevice.h │ ├── getconveyor.cpp │ ├── getconveyor.h │ ├── glasscoder.cpp │ ├── glasscoder.h │ ├── glassconv.cpp │ ├── glassconv.h │ ├── hlsconnector.cpp │ ├── hlsconnector.h │ ├── httpconnection.cpp │ ├── httpconnection.h │ ├── httpserver.cpp │ ├── httpserver.h │ ├── httpuser.cpp │ ├── httpuser.h │ ├── iceconnector.cpp │ ├── iceconnector.h │ ├── iceoutconnector.cpp │ ├── iceoutconnector.h │ ├── icestreamconnector.cpp │ ├── icestreamconnector.h │ ├── icyconnector.cpp │ ├── icyconnector.h │ ├── jackdevice.cpp │ ├── jackdevice.h │ ├── logsystemsyslog.cpp │ ├── metaserver.cpp │ ├── metaserver.h │ ├── meteraverage.cpp │ ├── meteraverage.h │ ├── mpegl2codec.cpp │ ├── mpegl2codec.h │ ├── mpegl3codec.cpp │ ├── mpegl3codec.h │ ├── netconveyor.cpp │ ├── netconveyor.h │ ├── opuscodec.cpp │ ├── opuscodec.h │ ├── pcm16codec.cpp │ ├── pcm16codec.h │ ├── socketmessage.cpp │ ├── socketmessage.h │ ├── socketserver.cpp │ ├── socketserver.h │ ├── vorbiscodec.cpp │ └── vorbiscodec.h ├── glasscommander │ ├── Makefile.am │ ├── configdialog.cpp │ ├── configdialog.h │ ├── deletedialog.cpp │ ├── deletedialog.h │ ├── filenamevalidator.cpp │ ├── filenamevalidator.h │ ├── glasscommander.cpp │ ├── glasscommander.h │ ├── glasswidget.cpp │ ├── glasswidget.h │ ├── instancedialog.cpp │ ├── instancedialog.h │ ├── playmeter.cpp │ └── playmeter.h ├── glassgui │ ├── Makefile.am │ ├── glassgui.cpp │ └── glassgui.h └── tests │ ├── Makefile.am │ ├── pipe_connect.cpp │ ├── pipe_connect.h │ ├── urldecode.cpp │ ├── urldecode.h │ ├── urlencode.cpp │ └── urlencode.h └── xdg ├── Makefile.am ├── glasscommander.desktop └── glassgui.desktop /AUTHORS: -------------------------------------------------------------------------------- 1 | The following have contributed to GlassCoder: 2 | 3 | Fred Gleason 4 | Application Architect 5 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## Top level automake.am 4 | ## 5 | ## Use automake to process this into a Makefile.in 6 | ## 7 | ## (C) Copyright 2014-2022 Fred Gleason 8 | ## 9 | ## This program is free software; you can redistribute it and/or modify 10 | ## it under the terms of the GNU General Public License version 2 as 11 | ## published by the Free Software Foundation. 12 | ## 13 | ## This program is distributed in the hope that it will be useful, 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ## GNU General Public License for more details. 17 | ## 18 | ## You should have received a copy of the GNU General Public 19 | ## License along with this program; if not, write to the Free Software 20 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | ## 22 | 23 | if DOCBOOK_AM 24 | DOCBOOK_AM_OPT = docs 25 | endif 26 | 27 | if PYTHON_AM 28 | PYTHON_AM_OPT = plugins 29 | endif 30 | 31 | SUBDIRS = debian $(DOCBOOK_AM_OPT) conf\ 32 | icons $(PYTHON_AM_OPT) \ 33 | src\ 34 | xdg 35 | 36 | deb: dist 37 | ./build_debs.sh 38 | 39 | rpm: dist 40 | cp glasscoder-$(VERSION).tar.gz $(HOME)/rpmbuild/SOURCES/ 41 | $(RPMBUILD) -ba --target $(ARCH)-$(VENDOR)-linux glasscoder.spec 42 | mv $(HOME)/rpmbuild/RPMS/$(ARCH)/glasscoder-*.rpm $(top_srcdir)/ 43 | mv $(HOME)/rpmbuild/SRPMS/glasscoder-*.src.rpm $(top_srcdir)/ 44 | rm $(HOME)/rpmbuild/SOURCES/glasscoder-$(VERSION).tar.gz 45 | rm -rf $(HOME)/rpmbuild/BUILD/glasscoder-$(VERSION) 46 | 47 | EXTRA_DIST = autogen.sh\ 48 | CODINGSTYLE\ 49 | get_distro.pl\ 50 | get_target.sh\ 51 | glasscoder.spec.in\ 52 | link_common.sh\ 53 | PACKAGE_VERSION 54 | 55 | CLEANFILES = *~\ 56 | *.buildinfo\ 57 | *.changes\ 58 | *.ddeb\ 59 | *.deb\ 60 | *.dsc\ 61 | *.mo\ 62 | *.rpm\ 63 | *.tar.gz\ 64 | *.tar.xz\ 65 | *.tgz\ 66 | *.zip 67 | 68 | DISTCLEANFILES = build_debs.sh\ 69 | glasscoder.spec\ 70 | config.guess\ 71 | config.sub\ 72 | ltmain.sh 73 | 74 | MAINTAINERCLEANFILES = *~\ 75 | *.tar.gz\ 76 | aclocal.m4\ 77 | compile\ 78 | config.guess\ 79 | config.status\ 80 | config.sub\ 81 | configure\ 82 | depcomp\ 83 | install-sh\ 84 | libtool\ 85 | ltmain.sh\ 86 | Makefile.in\ 87 | missing\ 88 | mkinstalldirs 89 | -------------------------------------------------------------------------------- /PACKAGE_VERSION: -------------------------------------------------------------------------------- 1 | 2.1.1int2 -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is the README file for the GlassCoder package. 2 | 3 | This software comes with ABSOLUTELY NO WARRANTY. See the file 'COPYING' for 4 | details. 5 | 6 | See the file 'INSTALL' for instructions on building GlassCoder from source. 7 | 8 | GlassCoder is a minimalist audio encoder for IceCast and Shoutcast streaming 9 | servers as well as HTTP Live Streaming (HLS). It supports the following 10 | audio sources: 11 | 12 | Advanced Linux Sound Architeture (ALSA) 13 | AudioScience HPI (ASIHPI) 14 | File Streaming (FILE) 15 | JACK Audio Connection Kit (JACK) 16 | 17 | The base GlassCoder streamer component utilizes no configuration files or 18 | GUI interface whatsoever; with the 'user interface' consisting entirely of 19 | the command-line invocation. As such, it is well suited for use cases where 20 | the encoder is completely driven by an external system or script. 21 | 22 | The following audio codecs are supported: 23 | 24 | MPEG-1/1.5 Layer 2 ('MP2') 25 | MPEG-1/1.5 Layer 3 ('MP3') 26 | MPEG-4 Advanced Audio Coding, High Efficiency Profile ('HE-AAC+') 27 | Ogg Opus 28 | Ogg Vorbis 29 | 30 | The following additional utilities are included: 31 | 32 | GlassGui, a GUI front end for a single instance of the glasscoder(1) audio 33 | encoder. It provides a convenient and discoverable means for creating and 34 | saving glasscoder(1) invocations as well as an instance management system 35 | for saving multiple sets of configurations on the local system. 36 | 37 | GlassCommander, a high-density GUI front end for the glasscoder(1) audio 38 | encoder. It provides a convenient and discoverable means for creating and 39 | saving glasscoder(1) invocations and an instance management system (fully 40 | compatible with that of glassgui(1)) for saving multiple sets of 41 | configurations on the local system in a manner that conserves screen 42 | real-estate. Glasscommander(1) is capable of hosting dozens of simultaneous 43 | glasscoder(1) instances while still allowing easy access to the control and 44 | status of each one. 45 | 46 | This product includes software developed by the OpenSSL Project 47 | for use in the OpenSSL Toolkit. (http://www.openssl.org/). 48 | 49 | This program is released under the GNU General Public License version 2 with 50 | the additional exemption that compiling, linking, and/or using OpenSSL is 51 | allowed. 52 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ## 3 | ## (C) Copyright 2012-2022 Fred Gleason 4 | ## 5 | ## Adapted from './autogen.sh' in the Jack Audio Connection Kit. 6 | ## Copyright (C) 2001-2003 Paul Davis, et al. 7 | ## 8 | ## This program is free software; you can redistribute it and/or modify 9 | ## it under the terms of version 2 of the GNU General Public License as 10 | ## published by the Free Software Foundation; 11 | ## 12 | ## This program is distributed in the hope that it will be useful, 13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ## GNU General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU General Public License 18 | ## along with this program; if not, write to the Free Software 19 | ## Foundation, Inc., 59 Temple Place, Suite 330, 20 | ## Boston, MA 02111-1307 USA 21 | ## 22 | 23 | # 24 | # Generate Debian packaging metadata 25 | # 26 | DATESTAMP=`date +%a,\ %d\ %b\ %Y\ %T\ %z` 27 | sed s/@VERSION@/`cat PACKAGE_VERSION`/ < debian/control.src > debian/control 28 | sed s/@VERSION@/`cat PACKAGE_VERSION`/ < debian/changelog.src | sed "s/@DATESTAMP@/$DATESTAMP/" > debian/changelog 29 | 30 | aclocal $ACLOCAL_FLAGS || { 31 | echo "aclocal \$ACLOCAL_FLAGS where \$ACLOCAL_FLAGS= failed, exiting..." 32 | exit 1 33 | } 34 | 35 | automake --add-missing -Wno-portability || { 36 | echo "automake --add-missing failed, exiting..." 37 | exit 1 38 | } 39 | 40 | autoconf || { 41 | echo "autoconf failed, exiting..." 42 | exit 1 43 | } 44 | -------------------------------------------------------------------------------- /build_debs.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # build_debs.sh 4 | # 5 | # Build Debian packages. 6 | # 7 | # (C) Copyright 2021 Fred Gleason 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License version 2 as 11 | # published by the Free Software Foundation. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public 19 | # License along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | # 22 | 23 | tar -zvxf glasscoder-@VERSION@.tar.gz 24 | mv glasscoder-@VERSION@.tar.gz glasscoder_@VERSION@.orig.tar.gz 25 | 26 | cd glasscoder-@VERSION@ 27 | dpkg-buildpackage -us -uc 28 | cd .. 29 | 30 | rm -rf glasscoder-@VERSION@ 31 | -------------------------------------------------------------------------------- /conf/Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## conf/Automake.am for GlassCoder 4 | ## 5 | ## (C) Copyright 2015 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License version 2 as 9 | ## published by the Free Software Foundation. 10 | ## 11 | ## This program is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public 17 | ## License along with this program; if not, write to the Free Software 18 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | ## 20 | ## 21 | ## by Fred Gleason 22 | ## 23 | ## Use automake to process this into a Makefile.in 24 | 25 | SUBDIRS = httpd 26 | 27 | CLEANFILES = *~ 28 | DISTCLEANFILES = moc_* 29 | MAINTAINERCLEANFILES = *~\ 30 | Makefile.in 31 | -------------------------------------------------------------------------------- /conf/httpd/Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## conf/httpd/Automake.am for GlassCoder 4 | ## 5 | ## (C) Copyright 2015 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License version 2 as 9 | ## published by the Free Software Foundation. 10 | ## 11 | ## This program is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public 17 | ## License along with this program; if not, write to the Free Software 18 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | ## 20 | ## 21 | ## by Fred Gleason 22 | ## 23 | ## Use automake to process this into a Makefile.in 24 | 25 | EXTRA_DIST = hls.conf\ 26 | hls_methods.pl\ 27 | hls.passwd\ 28 | README.httpd 29 | 30 | CLEANFILES = *~ 31 | DISTCLEANFILES = moc_* 32 | MAINTAINERCLEANFILES = *~\ 33 | Makefile.in 34 | -------------------------------------------------------------------------------- /conf/httpd/README.httpd: -------------------------------------------------------------------------------- 1 | README for Apache HLS Configuration 2 | 3 | The files in this directory are for a basic HTTP Live Streaming (HLS) 4 | setup on Apache. They should be installed as follows: 5 | 6 | Apache configuration directory: 7 | 8 | hls.conf 9 | hls.passwd 10 | 11 | The 'hls.passwd' file will need at least one password entry added to it 12 | to allow GlassCoder's HLS streaming connector to upload files. See the 13 | htpasswd(1) man page for details. 14 | 15 | Apache cgi-bin directory: 16 | 17 | hls_methods.pl 18 | -------------------------------------------------------------------------------- /conf/httpd/hls.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | AuthType Basic 4 | AuthName "HLS Publish Point" 5 | AuthBasicProvider file 6 | AuthUserFile /etc/httpd/conf.d/hls.passwd 7 | Require valid-user 8 | Script DELETE /cgi-bin/hls_methods.pl 9 | Script PUT /cgi-bin/hls_methods.pl 10 | 11 | 12 | -------------------------------------------------------------------------------- /conf/httpd/hls.passwd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElvishArtisan/GlassCoder/e23b6aff30fb17c7a0ba6b45a47b5432f281db0e/conf/httpd/hls.passwd -------------------------------------------------------------------------------- /conf/httpd/hls_methods.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # hls_methods.pl 4 | # 5 | # HTTP methods script for HLS streaming 6 | # 7 | # (C) 2015 Fred Gleason 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License version 2 as 11 | # published by the Free Software Foundation. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public 19 | # License along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | # 22 | 23 | sub Put 24 | { 25 | my $response=201; 26 | my $file_name=&DestinationPath(); 27 | my $file_len = $ENV{'CONTENT_LENGTH'}; 28 | 29 | if(stat($file_name)) { 30 | $response=204; 31 | } 32 | 33 | # 34 | # Copy Data 35 | # 36 | my $toread = $file_len; 37 | $content = ""; 38 | while ($toread > 0) 39 | { 40 | $nread = read(STDIN, $data, $file_len); 41 | $toread -= $nread; 42 | $content = $data; 43 | } 44 | if(!open(OUT, "> $file_name")) { 45 | &Reply(500,"PUT failed!\n"); 46 | } 47 | print OUT $content; 48 | close(OUT); 49 | 50 | &Reply($response,"OK"); 51 | } 52 | 53 | 54 | sub Delete 55 | { 56 | my $file_name=&DestinationPath(); 57 | if(stat($file_name)) { 58 | if(!unlink($file_name)) { 59 | &Reply(500,"Unable to delete\n"); 60 | } 61 | } 62 | &Reply(204,"OK"); 63 | } 64 | 65 | 66 | sub DestinationPath() 67 | { 68 | my $file_name=$ENV{'PATH_TRANSLATED'}; 69 | if(!$file_name) { 70 | &Reply(500,"No destination path provided."); 71 | } 72 | return $file_name; 73 | } 74 | 75 | sub Reply 76 | { 77 | print "Status: ".$_[0]."\n"; 78 | print "Content-type: text/html\n"; 79 | print "\n"; 80 | print $_[1]; 81 | exit 0; 82 | } 83 | 84 | 85 | # 86 | # Verify Method 87 | # 88 | if($ENV{'REQUEST_METHOD'} eq "PUT") { 89 | &Put(); 90 | } 91 | if($ENV{'REQUEST_METHOD'} eq "DELETE") { 92 | &Delete(); 93 | } 94 | &Reply(500,"Unsupported method.\n"); 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /debian/Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## Automake.am for GlassCoder debian/ 4 | ## 5 | ## (C) Copyright 2021-2022 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License as 9 | ## published by the Free Software Foundation; either version 2 of 10 | ## the License, or (at your option) any later version. 11 | ## 12 | ## This program is distributed in the hope that it will be useful, 13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ## GNU General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU General Public 18 | ## License along with this program; if not, write to the Free Software 19 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | ## 21 | ## Use automake to process this into a Makefile.in 22 | 23 | SUBDIRS = source 24 | 25 | EXTRA_DIST = changelog\ 26 | changelog.src\ 27 | control\ 28 | control.src\ 29 | copyright\ 30 | rules 31 | 32 | MAINTAINERCLEANFILES = changelog\ 33 | control 34 | -------------------------------------------------------------------------------- /debian/changelog.src: -------------------------------------------------------------------------------- 1 | glasscoder (@VERSION@-1) unstable; urgency=medium 2 | 3 | * Production release (see ChangeLog for details) 4 | 5 | -- Fred Gleason @DATESTAMP@ 6 | -------------------------------------------------------------------------------- /debian/control.src: -------------------------------------------------------------------------------- 1 | Source: glasscoder 2 | Section: sound 3 | Priority: optional 4 | Maintainer: Fred Gleason 5 | Build-Depends: debhelper-compat (= 12), autotools-dev, libfdk-aac-dev, libtwolame-dev, libmp3lame-dev, libopus-dev, libvorbis-dev 6 | Standards-Version: 4.4.1 7 | Homepage: https://github.com/ElvishArtisan/GlassCoder 8 | 9 | Package: glasscoder 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Recommends: libfdk-aac1, libtwolame0, libmp3lame0 13 | Description: Minimalist Audio Streaming Encoder 14 | Glasscoder is a live audio encoder intended for use with Shoutcast and Icecast 15 | streaming servers as well as HTTP Live Streams [HLS]. It can source audio 16 | from ALSA, JACK and AudioScience HPI devices and is capable of generating live 17 | audio streams in a variety of formats. It is controlled completely from the 18 | command-line, with no configuration files or GUI required. 19 | 20 | Package: glasscoder-gui 21 | Architecture: any 22 | Depends: ${shlibs:Depends}, ${misc:Depends}, glasscoder (= @VERSION@-1) 23 | Description: GlassGui and GlassCommander control applets for GlassCoder 24 | GlassGui is a control applet for driving a single instance of the GlassCoder 25 | audio streaming encoder. It provides a complete point-and-click interface 26 | for setting all of the GlassCoder parameters and can be used directly to 27 | instantiate an actual instance of GlassCoder or to generate a command-line 28 | invocation that can be copy/pasted into another environment. 29 | GlassCommander is a control applet for driving multiple simultaneous 30 | instances (potentially dozens) of the GlassCoder audio streaming encoder. 31 | It provides full visibility and control of the operating state of each 32 | GlassCoder instance while conserving screen real estate. 33 | 34 | Package: glasscoder-pypad 35 | Architecture: all 36 | Depends: ${misc:Depends}, python3 37 | Description: PyPAD script for Rivendell 38 | This package provides a PyPAD script for use with the Rivendell Radio 39 | Automation System. It can be used to send articulated PAD updates to 40 | GlassCoder instances. 41 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: glasscoder 3 | Upstream-Contact: fredg@paravelsystems.com 4 | Source: https://github.com/ElvishArtisan/GlassCoder 5 | 6 | Files: * 7 | Copyright: 2012-2021 Fred Gleason 8 | License: GPL-2 9 | This package is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License version 2 as 11 | published by the Free Software Foundation. 12 | 13 | This package is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see 20 | 21 | On Debian systems, the complete text of the GNU General 22 | Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". 23 | 24 | Files: docs/* 25 | Copyright: 2015-2021 Fred Gleason 26 | License: GFDL-1.3 27 | Permission is granted to copy, distribute and/or modify this documentation 28 | under the terms of the GNU Free Documentation License, Version 1.3 29 | or any later version published by the Free Software Foundation; 30 | with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. 31 | A copy of the license is included in "/usr/share/common-licenses/GFDL-1.3". 32 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | build: 4 | dh_update_autotools_config 5 | dh_autoreconf 6 | ./configure --prefix=/usr 7 | make $(DEBUILD_MAKE_ARGS) 8 | 9 | binary: 10 | dh_testroot 11 | dh_prep 12 | dh_auto_install 13 | dh_installchangelogs ChangeLog 14 | mkdir -p debian/glasscoder/usr/bin 15 | mv debian/tmp/usr/bin/glasscoder debian/glasscoder/usr/bin/ 16 | mv debian/tmp/usr/bin/glassconv debian/glasscoder/usr/bin/ 17 | mkdir -p debian/glasscoder/usr/share/man/man1 18 | mv debian/tmp/usr/share/man/man1/glasscoder.1 debian/glasscoder/usr/share/man/man1/ 19 | mkdir -p debian/glasscoder/usr/share/man/man7 20 | mv debian/tmp/usr/share/man/man7/glasscoder-ipc.7 debian/glasscoder/usr/share/man/man7/ 21 | mkdir -p debian/glasscoder/usr/share/doc/glasscoder 22 | cp NEWS debian/glasscoder/usr/share/doc/glasscoder/ 23 | mkdir -p debian/glasscoder-gui/usr/bin 24 | mv debian/tmp/usr/bin/glasscommander debian/glasscoder-gui/usr/bin/ 25 | mv debian/tmp/usr/bin/glassgui debian/glasscoder-gui/usr/bin/ 26 | mkdir -p debian/glasscoder-gui/usr/share/man/man1 27 | mv debian/tmp/usr/share/man/man1/glasscommander.1 debian/glasscoder-gui/usr/share/man/man1 28 | mv debian/tmp/usr/share/man/man1/glassgui.1 debian/glasscoder-gui/usr/share/man/man1 29 | mkdir -p debian/glasscoder-gui/usr/share/icons/hicolor 30 | mv debian/tmp/usr/share/icons/hicolor/16x16 debian/glasscoder-gui/usr/share/icons/hicolor/ 31 | mv debian/tmp/usr/share/icons/hicolor/22x22 debian/glasscoder-gui/usr/share/icons/hicolor/ 32 | mv debian/tmp/usr/share/icons/hicolor/48x48 debian/glasscoder-gui/usr/share/icons/hicolor/ 33 | mv debian/tmp/usr/share/applications debian/glasscoder-gui/usr/share/ 34 | mkdir -p debian/glasscoder-pypad/usr/lib 35 | mv debian/tmp/usr/lib/rivendell debian/glasscoder-pypad/usr/lib/ 36 | dh_strip_nondeterminism 37 | dh_compress 38 | dh_fixperms 39 | dh_missing 40 | dh_dwz 41 | dh_strip 42 | dh_makeshlibs 43 | dh_shlibdeps 44 | dh_installdeb 45 | dh_gencontrol 46 | dh_md5sums 47 | dh_builddeb 48 | 49 | %: 50 | dh $@ 51 | -------------------------------------------------------------------------------- /debian/source/Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## Automake.am for GlassPlayer debian/source 4 | ## 5 | ## (C) Copyright 2021 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License as 9 | ## published by the Free Software Foundation; either version 2 of 10 | ## the License, or (at your option) any later version. 11 | ## 12 | ## This program is distributed in the hope that it will be useful, 13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ## GNU General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU General Public 18 | ## License along with this program; if not, write to the Free Software 19 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | ## 21 | ## Use automake to process this into a Makefile.in 22 | 23 | EXTRA_DIST = format 24 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /docs/Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## docs/Automake.am for GlassCoder 4 | ## 5 | ## (C) Copyright 2014-2015 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License version 2 as 9 | ## published by the Free Software Foundation. 10 | ## 11 | ## This program is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public 17 | ## License along with this program; if not, write to the Free Software 18 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | ## 20 | ## 21 | ## by Fred Gleason 22 | ## 23 | ## Use automake to process this into a Makefile.in 24 | 25 | # The dependency for man pages 26 | %.1: %.xml 27 | xsltproc $(DOCBOOK_STYLESHEETS)/manpages/docbook.xsl $< 28 | %.7: %.xml 29 | xsltproc $(DOCBOOK_STYLESHEETS)/manpages/docbook.xsl $< 30 | %.html: %.xml 31 | xsltproc -o $@ $(DOCBOOK_STYLESHEETS)/xhtml/docbook.xsl $< 32 | 33 | all-local: glasscoder.1 glasscoder.html\ 34 | glasscoder-ipc.7 glasscoder-ipc.xml\ 35 | glasscommander.1 glasscommander.html\ 36 | glassgui.1 glassgui.html 37 | 38 | man_MANS = glasscoder.1\ 39 | glasscoder-ipc.7\ 40 | glasscommander.1\ 41 | glassgui.1 42 | 43 | EXTRA_DIST = glasscoder.1\ 44 | glasscoder.html\ 45 | glasscoder.xml.in\ 46 | glasscoder-ipc.7\ 47 | glasscoder-ipc.html\ 48 | glasscoder-ipc.xml\ 49 | glasscommander.1\ 50 | glasscommander.html\ 51 | glasscommander.xml\ 52 | glassgui.1\ 53 | glassgui.html\ 54 | glassgui.xml 55 | 56 | CLEANFILES = *~ 57 | DISTCLEANFILES = *.1\ 58 | *.7\ 59 | *.html\ 60 | glasscoder.xml\ 61 | moc_* 62 | MAINTAINERCLEANFILES = *~\ 63 | *.fo\ 64 | *.pdf\ 65 | Makefile.in 66 | -------------------------------------------------------------------------------- /docs/glasscommander.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | glasscommander 8 | 1 9 | January 2020 10 | Linux Audio Manual 11 | 12 | 13 | glasscommander 14 | High-density GUI front-end for the 15 | glasscoder1 16 | audio encoder 17 | 18 | 19 | 20 | 21 | Fred 22 | Gleason 23 | fredg@paravelsystems.com 24 | 25 | Application Author 26 | 27 | 28 | 29 | 32 | 33 | 34 | glasscommander OPTIONS 35 | 36 | 37 | 38 | 39 | Description 40 | 41 | glasscommander1 is a high-density 42 | GUI front end for the glasscoder1 43 | audio encoder. It provides a convenient and discoverable means for 44 | creating and saving glasscoder1 45 | invocations and an instance management system (fully compatible with that of 46 | glassgui1) for saving multiple 47 | sets of configurations on the local system in a manner that conserves 48 | screen real-estate. 49 | glasscommander1 is capable 50 | of hosting dozens of simultaneous 51 | glasscoder1 instances while 52 | still allowing easy access to the control and status of each one. 53 | 54 | 55 | 56 | Options 57 | 58 | 59 | dir 60 | 61 | 62 | Use dir as the location for storing 63 | instance data. Default value is 64 | $HOME/.glassgui. 65 | 66 | 67 | 68 | 69 | 70 | 71 | Author 72 | 73 | Fred Gleason <fredg@paravelsystems.com> 74 | 75 | 76 | 77 | See Also 78 | 79 | 80 | glasscoder1 81 | , 82 | 83 | glassgui1 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /get_distro.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -W 2 | 3 | # get_distro.pl 4 | # 5 | # Read various fields from 'os-release'. 6 | # Used as part of the AR_GET_DISTRO() macro. 7 | # 8 | # See https://www.freedesktop.org/software/systemd/man/os-release.html 9 | # for a description of the various fields. 10 | # 11 | # (C) Copyright 2012-2021 Fred Gleason 12 | # 13 | # This program is free software; you can redistribute it and/or modify 14 | # it under the terms of the GNU General Public License as 15 | # published by the Free Software Foundation; either version 2 of 16 | # the License, or (at your option) any later version. 17 | # 18 | # This program is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | # GNU General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU General Public 24 | # License along with this program; if not, write to the Free Software 25 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 26 | # 27 | 28 | my $usage="USAGE: get_distro.pl NAME|PRETTY_NAME|ID|ID_LIKE|VERSION|MAJOR|MINOR|POINT"; 29 | 30 | if($ARGV[0] eq "NAME") { 31 | print &Extract("NAME"); 32 | exit 0; 33 | } 34 | 35 | if($ARGV[0] eq "PRETTY_NAME") { 36 | print &Extract("PRETTY_NAME"); 37 | exit 0; 38 | } 39 | 40 | if($ARGV[0] eq "ID") { 41 | print &Extract("ID"); 42 | exit 0; 43 | } 44 | 45 | if($ARGV[0] eq "ID_LIKE") { 46 | print &Extract("ID_LIKE"); 47 | exit 0; 48 | } 49 | 50 | if($ARGV[0] eq "VERSION") { 51 | print &Extract("VERSION_ID"); 52 | exit 0; 53 | } 54 | 55 | if($ARGV[0] eq "MAJOR") { 56 | my $ver=&Extract("VERSION_ID"); 57 | my @f0=split '\.',$ver; 58 | print $f0[0]; 59 | exit 0; 60 | } 61 | 62 | if($ARGV[0] eq "MINOR") { 63 | my $ver=&Extract("VERSION_ID"); 64 | my @f0=split '\.',$ver; 65 | if(scalar(@f0)>=2) { 66 | print $f0[1]; 67 | exit 0; 68 | } 69 | print "0"; 70 | exit 0; 71 | } 72 | 73 | if($ARGV[0] eq "POINT") { 74 | my $ver=&Extract("VERSION_ID"); 75 | my @f0=split '\.',$ver; 76 | if(scalar(@f0)>=3) { 77 | print $f0[2]; 78 | exit 0; 79 | } 80 | print "0"; 81 | exit 0; 82 | } 83 | 84 | print $usage; 85 | exit 256; 86 | 87 | 88 | sub Extract 89 | { 90 | if((open RELEASE,"<","/etc/os-release") || 91 | (open RELEASE,"<","/usr/lib/os-release")) { 92 | while() { 93 | my @f0=split "\n",$_; 94 | for(my $i=0;$i<@f0;$i++) { 95 | my @f1=split "=",$f0[$i]; 96 | if($f1[0] eq $_[0]) { 97 | $f1[1]=~s/^"(.*)"$/$1/; 98 | return $f1[1]; 99 | # return substr($f1[1],1,length($f1[1])-2); 100 | } 101 | } 102 | } 103 | } 104 | return ""; 105 | } 106 | 107 | 108 | sub GetVersion 109 | { 110 | if(open VERSION,"<",$_[0]) { 111 | my $version=; 112 | my @f0=split " ",$version; 113 | for(my $i=0;$i<@f0;$i++) { 114 | my @f1=split "[.]",$f0[$i]; 115 | if(@f1>1) { 116 | return $f0[$i]; 117 | } 118 | } 119 | } 120 | return ""; 121 | } 122 | 123 | 124 | sub GetMajor 125 | { 126 | my @f0=split "[.]",&GetVersion($_[0]); 127 | 128 | return $f0[0]; 129 | } 130 | 131 | 132 | sub GetMinor 133 | { 134 | my @f0=split "[.]",&GetVersion($_[0]); 135 | 136 | if(@f0 ge 2) { 137 | return $f0[1]; 138 | } 139 | return ""; 140 | } 141 | 142 | 143 | sub GetPoint 144 | { 145 | my @f0=split "[.]",&GetVersion($_[0]); 146 | 147 | if(@f0 ge 3) { 148 | return $f0[2]; 149 | } 150 | return ""; 151 | } 152 | -------------------------------------------------------------------------------- /get_target.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # get_target.sh 4 | # 5 | # Return machine target information from gcc(1) 6 | # Used as part of the AR_GCC_TARGET() macro. 7 | # 8 | # (C) Copyright 2012 Fred Gleason 9 | # 10 | # $Id: get_target.sh,v 1.1.1.1 2014/02/17 13:26:17 cvs Exp $ 11 | # 12 | # This program is free software; you can redistribute it and/or modify 13 | # it under the terms of the GNU General Public License as 14 | # published by the Free Software Foundation; either version 2 of 15 | # the License, or (at your option) any later version. 16 | # 17 | # This program is distributed in the hope that it will be useful, 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | # GNU General Public License for more details. 21 | # 22 | # You should have received a copy of the GNU General Public 23 | # License along with this program; if not, write to the Free Software 24 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 | # 26 | 27 | $1 -dumpmachine > ./gcc_arch 28 | 29 | case "$3" in 30 | arch) 31 | $2 -F- "// {print \$1}" ./gcc_arch 32 | ;; 33 | distro) 34 | $2 -F- "// {print \$2}" ./gcc_arch 35 | ;; 36 | os) 37 | $2 -F- "// {print \$3}" ./gcc_arch 38 | ;; 39 | esac 40 | 41 | rm -f ./gcc_arch 42 | 43 | 44 | # End of get_target.sh 45 | -------------------------------------------------------------------------------- /icons/Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## icons/automake.am for GlassCoder 4 | ## 5 | ## (C) Copyright 2015 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License version 2 as 9 | ## published by the Free Software Foundation. 10 | ## 11 | ## This program is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public 17 | ## License along with this program; if not, write to the Free Software 18 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | ## 20 | ## 21 | ## Use automake to process this into a Makefile.in 22 | 23 | install-exec-am: 24 | mkdir -p $(DESTDIR)@prefix@/share/icons/hicolor/16x16/apps 25 | cp glasscoder-16x16.png $(DESTDIR)@prefix@/share/icons/hicolor/16x16/apps/glasscoder.png 26 | mkdir -p $(DESTDIR)@prefix@/share/icons/hicolor/22x22/apps 27 | cp glasscoder-22x22.png $(DESTDIR)@prefix@/share/icons/hicolor/22x22/apps/glasscoder.png 28 | mkdir -p $(DESTDIR)@prefix@/share/icons/hicolor/48x48/apps 29 | cp glasscoder-48x48.png $(DESTDIR)@prefix@/share/icons/hicolor/48x48/apps/glasscoder.png 30 | 31 | 32 | uninstall-local: 33 | rm -f $(DESTDIR)@prefix@/share/icons/hicolor/16x16/apps/glasscoder.png 34 | rm -f $(DESTDIR)@prefix@/share/icons/hicolor/22x22/apps/glasscoder.png 35 | rm -f $(DESTDIR)@prefix@/share/icons/hicolor/48x48/apps/glasscoder.png 36 | 37 | EXTRA_DIST = back.xpm\ 38 | glasscoder-16x16.png\ 39 | glasscoder-16x16.xpm\ 40 | glasscoder-22x22.png\ 41 | glasscoder-48x48.png\ 42 | minussign.xpm\ 43 | plussign.xpm 44 | 45 | CLEANFILES = *~ 46 | 47 | MAINTAINERCLEANFILES = *~\ 48 | aclocal.m4\ 49 | configure\ 50 | Makefile.in 51 | -------------------------------------------------------------------------------- /icons/back.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * back_xpm[] = { 3 | "22 22 116 2", 4 | " c None", 5 | ". c #84989C", 6 | "+ c #9DA696", 7 | "@ c #9EA795", 8 | "# c #9FA896", 9 | "$ c #9FA897", 10 | "% c #A0A997", 11 | "& c #A0A998", 12 | "* c #9EA999", 13 | "= c #82959F", 14 | "- c #C7CCC2", 15 | "; c #F9F9F8", 16 | "> c #F9F9F9", 17 | ", c #FAFAF9", 18 | "' c #FAFAFA", 19 | ") c #C8CFC9", 20 | "! c #8AA4BC", 21 | "~ c #CFD5D0", 22 | "{ c #D0D6D0", 23 | "] c #CED4D0", 24 | "^ c #819CBA", 25 | "/ c #3667A5", 26 | "( c #74A0D0", 27 | "_ c #729FCF", 28 | ": c #719CCB", 29 | "< c #709DCE", 30 | "[ c #3666A5", 31 | "} c #79A4D1", 32 | "| c #719CCA", 33 | "1 c #5A646A", 34 | "2 c #75A1D0", 35 | "3 c #7FA8D3", 36 | "4 c #719BC9", 37 | "5 c #616B71", 38 | "6 c #555753", 39 | "7 c #7BA5D2", 40 | "8 c #84ABD5", 41 | "9 c #709AC7", 42 | "0 c #61696F", 43 | "a c #A0A2A2", 44 | "b c #80A8D3", 45 | "c c #89AFD7", 46 | "d c #709AC6", 47 | "e c #60676C", 48 | "f c #B1B3B2", 49 | "g c #F5F5F5", 50 | "h c #676965", 51 | "i c #636561", 52 | "j c #606563", 53 | "k c #6A7782", 54 | "l c #38659F", 55 | "m c #8FB3D9", 56 | "n c #7099C3", 57 | "o c #5F666A", 58 | "p c #B3B4B4", 59 | "q c #F3F3F3", 60 | "r c #EDEDED", 61 | "s c #F2F2F2", 62 | "t c #F6F6F6", 63 | "u c #F8F8F8", 64 | "v c #FCFCFC", 65 | "w c #FEFEFE", 66 | "x c #FFFFFF", 67 | "y c #8B8D8C", 68 | "z c #4D5F71", 69 | "A c #95B7DB", 70 | "B c #5D6A72", 71 | "C c #EBEBEB", 72 | "D c #E4E4E4", 73 | "E c #E6E6E6", 74 | "F c #EAEAEA", 75 | "G c #EEEEEE", 76 | "H c #F1F1F1", 77 | "I c #C3C3C3", 78 | "J c #555B5B", 79 | "K c #9ABADD", 80 | "L c #6E97C1", 81 | "M c #5A6062", 82 | "N c #A6A7A6", 83 | "O c #F4F4F4", 84 | "P c #C6C6C6", 85 | "Q c #565B5A", 86 | "R c #A0BEDF", 87 | "S c #668CB4", 88 | "T c #5B6163", 89 | "U c #A3A5A4", 90 | "V c #565854", 91 | "W c #5C5F5C", 92 | "X c #818281", 93 | "Y c #A5C2E1", 94 | "Z c #678DB5", 95 | "` c #5A6163", 96 | " . c #929493", 97 | ".. c #5A7EA4", 98 | "+. c #567595", 99 | "@. c #5B5F5C", 100 | "#. c #ABC6E2", 101 | "$. c #678EB7", 102 | "%. c #5A6265", 103 | "&. c #8191A2", 104 | "*. c #B0CAE4", 105 | "=. c #688FB8", 106 | "-. c #575F64", 107 | ";. c #ACC5DF", 108 | ">. c #3C6293", 109 | ",. c #3666A4", 110 | "'. c #B6CDE6", 111 | "). c #B4CCE5", 112 | "!. c #3566A5", 113 | "~. c #B0C9E3", 114 | "{. c #BCD1E8", 115 | "]. c #ADC6E2", 116 | "^. c #305A8F", 117 | "/. c #3565A3", 118 | "(. c #3465A4", 119 | "_. c #2E5789", 120 | " ", 121 | " . + @ @ @ @ @ @ @ @ @ @ @ @ # $ % & * = ", 122 | " - ; > > > > > , , , , , , , , ' ' ' , ) ", 123 | " ! ~ { { { { { { { { { { { { { { { { ] ^ ", 124 | " / ( _ _ _ _ _ : _ _ _ _ _ _ _ _ _ _ < [ ", 125 | " / } _ _ _ _ | 1 _ _ _ _ _ _ _ _ _ _ 2 [ ", 126 | " / 3 _ _ _ 4 5 6 _ _ _ _ _ _ _ _ _ _ 7 [ ", 127 | " / 8 _ _ 9 0 a 6 _ _ _ _ _ _ _ _ _ _ b [ ", 128 | " / c _ d e f g h i i i i i i i i i j k l ", 129 | " / m n o p q r s q q g t u ' v w x t y z ", 130 | " / A B h g C D E E E F G H g > v w w I J ", 131 | " / K L M N q O O q q g t u ' v w x w P Q ", 132 | " / R _ S T U O V 6 6 6 6 6 6 6 6 6 W X Q ", 133 | " / Y _ _ Z ` .6 ..................+.@.6 ", 134 | " / #._ _ _ $.%.6 _ _ _ _ _ _ _ _ _ _ &.6 ", 135 | " / *._ _ _ _ =.-._ _ _ _ _ _ _ _ _ _ ;.>. ", 136 | " ,.'._ _ _ _ _ | _ _ _ _ _ _ _ _ _ _ ).!. ", 137 | " ,.~.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.{.].,. ", 138 | " ^./.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(.(./._. ", 139 | " ", 140 | " ", 141 | " "}; 142 | -------------------------------------------------------------------------------- /icons/glasscoder-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElvishArtisan/GlassCoder/e23b6aff30fb17c7a0ba6b45a47b5432f281db0e/icons/glasscoder-16x16.png -------------------------------------------------------------------------------- /icons/glasscoder-16x16.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * glasscoder_16x16_xpm[] = { 3 | "16 16 137 2", 4 | " c None", 5 | ". c #D5D9D2", 6 | "+ c #F9F9F8", 7 | "@ c #FFFFFF", 8 | "# c #FEFEFE", 9 | "$ c #FDFDFD", 10 | "% c #FDFDFC", 11 | "& c #FCFCFC", 12 | "* c #FBFBFB", 13 | "= c #FBFBFA", 14 | "- c #FAFAF9", 15 | "; c #F9F9F9", 16 | "> c #F8F8F7", 17 | ", c #ECEDEB", 18 | "' c #D0D2CC", 19 | ") c #D3D7CF", 20 | "! c #EEEEEC", 21 | "~ c #D2D2D0", 22 | "{ c #737471", 23 | "] c #F6F6F5", 24 | "^ c #CBCFC7", 25 | "/ c #838482", 26 | "( c #4C4E4B", 27 | "_ c #C9CDC5", 28 | ": c #D1D5CD", 29 | "< c #5F605D", 30 | "[ c #585A56", 31 | "} c #F5F5F4", 32 | "| c #C8CBC4", 33 | "1 c #D0D4CC", 34 | "2 c #60615D", 35 | "3 c #5E605D", 36 | "4 c #636561", 37 | "5 c #EDEDEB", 38 | "6 c #F3F3F1", 39 | "7 c #C6CAC2", 40 | "8 c #CED2CA", 41 | "9 c #5D5F5A", 42 | "0 c #C4C5C4", 43 | "a c #C2C3C2", 44 | "b c #575954", 45 | "c c #6F716D", 46 | "d c #E9E9E7", 47 | "e c #EFEFEC", 48 | "f c #C5C8C1", 49 | "g c #CDD0C9", 50 | "h c #4F504D", 51 | "i c #A3A7A0", 52 | "j c #A1A49E", 53 | "k c #494A47", 54 | "l c #ECECEA", 55 | "m c #EBEBE9", 56 | "n c #7A7D78", 57 | "o c #E6E6E2", 58 | "p c #EBEBE8", 59 | "q c #C3C6BF", 60 | "r c #FAFAFA", 61 | "s c #6E716B", 62 | "t c #40423F", 63 | "u c #3E403D", 64 | "v c #6D6F6A", 65 | "w c #E9E9E6", 66 | "x c #E8E8E5", 67 | "y c #797B75", 68 | "z c #626561", 69 | "A c #E2E2DE", 70 | "B c #E6E6E3", 71 | "C c #BFC2BB", 72 | "D c #CACDC6", 73 | "E c #92948F", 74 | "F c #E5E5E2", 75 | "G c #E4E4E0", 76 | "H c #61635E", 77 | "I c #5B5D58", 78 | "J c #DEDEDA", 79 | "K c #E1E1DD", 80 | "L c #B4B7AF", 81 | "M c #E7E7E4", 82 | "N c #9DA09A", 83 | "O c #E1E1DE", 84 | "P c #E0E0DC", 85 | "Q c #535551", 86 | "R c #4D4F4B", 87 | "S c #DBDBD6", 88 | "T c #DCDCD7", 89 | "U c #A8ACA3", 90 | "V c #F3F3F2", 91 | "W c #E3E3E0", 92 | "X c #C6C7C3", 93 | "Y c #A9ABA5", 94 | "Z c #DEDED9", 95 | "` c #DDDDD8", 96 | " . c #9B9D98", 97 | ".. c #444543", 98 | "+. c #424341", 99 | "@. c #9A9A97", 100 | "#. c #D7D7D2", 101 | "$. c #D6D6D0", 102 | "%. c #9CA196", 103 | "&. c #F0F0EE", 104 | "*. c #DFDFDB", 105 | "=. c #E9EAE8", 106 | "-. c #C7C9C4", 107 | ";. c #E8E9E6", 108 | ">. c #DADAD5", 109 | ",. c #D9D9D4", 110 | "'. c #E7E8E6", 111 | "). c #E6E7E5", 112 | "!. c #D3D3CE", 113 | "~. c #D2D2CC", 114 | "{. c #91958A", 115 | "]. c #F6F6F4", 116 | "^. c #D6D6D1", 117 | "/. c #D5D5D0", 118 | "(. c #F4F4F2", 119 | "_. c #D1D1CB", 120 | ":. c #CDCDC7", 121 | "<. c #878C80", 122 | "[. c #C1C4BF", 123 | "}. c #D9DBD6", 124 | "|. c #E4E4E1", 125 | "1. c #E3E3DF", 126 | "2. c #E0E0DD", 127 | "3. c #D9D9D3", 128 | "4. c #D3D3CD", 129 | "5. c #A7AAA1", 130 | "6. c #8B9084", 131 | "7. c #B3B6AD", 132 | "8. c #ABAFA6", 133 | "9. c #A6AAA1", 134 | "0. c #A2A69C", 135 | "a. c #9DA197", 136 | "b. c #989C92", 137 | "c. c #93988D", 138 | "d. c #8F9388", 139 | "e. c #8A8F83", 140 | "f. c #868B7F", 141 | ". + @ @ @ # $ % & * = - ; > , ' ", 142 | ") @ ! ~ { { ~ ! ! ~ { { ~ ! ] ^ ", 143 | ") @ ! / ( ( / ! ! / ( ( / ! ] _ ", 144 | ": # ! < [ [ < ! ! < [ [ < ! } | ", 145 | "1 $ ! 2 3 3 2 ! ! 4 4 4 4 5 6 7 ", 146 | "8 & ! 9 0 a b ! ! c c c c d e f ", 147 | "g * ! h i j k l m n n n n o p q ", 148 | "^ r ! s t u v w x y z z y A B C ", 149 | "D + p E E E E F G H 0 a I J K L ", 150 | "| ] M j N N j O P Q i j R S T U ", 151 | "7 V W X Y Y X Z ` ...+.@.#.$.%.", 152 | "f &.*.=.-.-.;.>.,.'.-.-.).!.~.{.", 153 | "q m T K ].} J ^./.S (.(.,._.:.<.", 154 | "[.}.|.1.2.Z S 3./.4._._._.:.5.6.", 155 | " 7.8.9.0.a.b.c.d.e.f.f.f.<.6. ", 156 | " "}; 157 | -------------------------------------------------------------------------------- /icons/glasscoder-22x22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElvishArtisan/GlassCoder/e23b6aff30fb17c7a0ba6b45a47b5432f281db0e/icons/glasscoder-22x22.png -------------------------------------------------------------------------------- /icons/glasscoder-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElvishArtisan/GlassCoder/e23b6aff30fb17c7a0ba6b45a47b5432f281db0e/icons/glasscoder-48x48.png -------------------------------------------------------------------------------- /icons/minussign.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * minussign_xpm[] = { 3 | "22 22 69 1", 4 | " c None", 5 | ". c #3565A4", 6 | "+ c #3363A2", 7 | "@ c #3161A0", 8 | "# c #30609E", 9 | "$ c #2F5F9D", 10 | "% c #2E5D9C", 11 | "& c #2D5C9B", 12 | "* c #2D5B99", 13 | "= c #2C5A98", 14 | "- c #2B5997", 15 | "; c #2A5795", 16 | "> c #295694", 17 | ", c #285593", 18 | "' c #285491", 19 | ") c #2A5592", 20 | "! c #3162A0", 21 | "~ c #7F9EC6", 22 | "{ c #88A5CA", 23 | "] c #87A4CA", 24 | "^ c #86A3C9", 25 | "/ c #84A2C9", 26 | "( c #83A2C8", 27 | "_ c #82A0C7", 28 | ": c #80A0C7", 29 | "< c #7F9DC5", 30 | "[ c #7D9DC5", 31 | "} c #7B9BC4", 32 | "| c #6F92BE", 33 | "1 c #25508D", 34 | "2 c #2F5E9D", 35 | "3 c #7798C2", 36 | "4 c #3B6AA7", 37 | "5 c #3869A6", 38 | "6 c #3768A5", 39 | "7 c #3667A4", 40 | "8 c #3566A4", 41 | "9 c #3667A5", 42 | "0 c #3768A6", 43 | "a c #396AA7", 44 | "b c #396AA8", 45 | "c c #406FAB", 46 | "d c #234D8B", 47 | "e c #2D5C9A", 48 | "f c #4271AC", 49 | "g c #4573AD", 50 | "h c #4674AE", 51 | "i c #4574AE", 52 | "j c #4674AF", 53 | "k c #4575AF", 54 | "l c #4574B0", 55 | "m c #4675B0", 56 | "n c #4776B0", 57 | "o c #4675B1", 58 | "p c #4272AD", 59 | "q c #224B88", 60 | "r c #2B5B98", 61 | "s c #2B5896", 62 | "t c #285592", 63 | "u c #275391", 64 | "v c #265290", 65 | "w c #25518E", 66 | "x c #24508D", 67 | "y c #234E8C", 68 | "z c #224D8B", 69 | "A c #224C89", 70 | "B c #214B88", 71 | "C c #214A87", 72 | "D c #244D8A", 73 | " ", 74 | " ", 75 | " ", 76 | " ", 77 | " ", 78 | " ", 79 | " ", 80 | " ", 81 | " .+@#$%&*=-;>,') ", 82 | " !~{]^/(_:~<[}|1 ", 83 | " 23456789605abcd ", 84 | " efghijjklmnmopq ", 85 | " rs;>tuvwxyzABCD ", 86 | " ", 87 | " ", 88 | " ", 89 | " ", 90 | " ", 91 | " ", 92 | " ", 93 | " ", 94 | " "}; 95 | -------------------------------------------------------------------------------- /icons/plussign.xpm: -------------------------------------------------------------------------------- 1 | /* XPM */ 2 | static const char * plussign_xpm[] = { 3 | "22 22 105 2", 4 | " c None", 5 | ". c #3B6BA8", 6 | "+ c #3666A5", 7 | "@ c #3465A4", 8 | "# c #3566A5", 9 | "$ c #AAC1DC", 10 | "% c #B0C5DE", 11 | "& c #8AA9CE", 12 | "* c #3364A2", 13 | "= c #ABC2DC", 14 | "- c #7B9EC7", 15 | "; c #86A6CC", 16 | "> c #30609F", 17 | ", c #3262A1", 18 | "' c #A2BAD8", 19 | ") c #6D92C0", 20 | "! c #799BC5", 21 | "~ c #2F5E9C", 22 | "{ c #9AB3D3", 23 | "] c #5E87BA", 24 | "^ c #6C91BF", 25 | "/ c #2D5B99", 26 | "( c #3565A4", 27 | "_ c #3363A2", 28 | ": c #3161A0", 29 | "< c #30609E", 30 | "[ c #2F5F9D", 31 | "} c #3B67A3", 32 | "| c #8FABCE", 33 | "1 c #507BB1", 34 | "2 c #5F86B9", 35 | "3 c #315D9B", 36 | "4 c #2A5795", 37 | "5 c #295694", 38 | "6 c #285593", 39 | "7 c #285491", 40 | "8 c #2A5592", 41 | "9 c #3162A0", 42 | "0 c #82A1C8", 43 | "a c #8AA7CB", 44 | "b c #89A6CA", 45 | "c c #86A4CA", 46 | "d c #658ABA", 47 | "e c #416FAA", 48 | "f c #4975AE", 49 | "g c #7D9CC5", 50 | "h c #84A2C8", 51 | "i c #83A2C8", 52 | "j c #7597C0", 53 | "k c #25508D", 54 | "l c #2F5E9D", 55 | "m c #7A9BC4", 56 | "n c #3B6AA7", 57 | "o c #3969A7", 58 | "p c #3868A6", 59 | "q c #3667A4", 60 | "r c #3667A5", 61 | "s c #3768A6", 62 | "t c #3A6AA8", 63 | "u c #3A6AA9", 64 | "v c #4C79B1", 65 | "w c #234D8B", 66 | "x c #2D5C9A", 67 | "y c #4775AE", 68 | "z c #4D7AB1", 69 | "A c #4E7AB2", 70 | "B c #4674AF", 71 | "C c #3C6EAB", 72 | "D c #4775B0", 73 | "E c #517DB4", 74 | "F c #527EB5", 75 | "G c #537FB6", 76 | "H c #4D7BB2", 77 | "I c #224B88", 78 | "J c #2B5B98", 79 | "K c #2B5896", 80 | "L c #285592", 81 | "M c #2B5796", 82 | "N c #80A2CB", 83 | "O c #4576B1", 84 | "P c #5783BA", 85 | "Q c #285391", 86 | "R c #224D8B", 87 | "S c #224C89", 88 | "T c #214B88", 89 | "U c #214A87", 90 | "V c #244D8A", 91 | "W c #25518E", 92 | "X c #8DACD1", 93 | "Y c #4D7EB9", 94 | "Z c #5E8BBF", 95 | "` c #214C89", 96 | " . c #234E8C", 97 | ".. c #92B1D5", 98 | "+. c #5486BF", 99 | "@. c #6592C4", 100 | "#. c #204A87", 101 | "$. c #96B6DA", 102 | "%. c #5C8EC4", 103 | "&. c #6C98CB", 104 | "*. c #204B88", 105 | "=. c #8FB0D7", 106 | "-. c #719ECF", 107 | ";. c #6996C9", 108 | ">. c #1F4172", 109 | " ", 110 | " ", 111 | " ", 112 | " . + @ + . ", 113 | " # $ % & * ", 114 | " @ = - ; > ", 115 | " , ' ) ! ~ ", 116 | " > { ] ^ / ", 117 | " ( _ : < [ } | 1 2 3 4 5 6 7 8 ", 118 | " 9 0 a a b c d e f g h i 0 j k ", 119 | " l m n o p q @ # r s o t u v w ", 120 | " x y v z z A B C D E F F G H I ", 121 | " J K 4 5 L M N O P Q R S T U V ", 122 | " W X Y Z ` ", 123 | " ...+.@.#. ", 124 | " ` $.%.&.#. ", 125 | " *.=.-.;.*. ", 126 | " >.*.#.*.>. ", 127 | " ", 128 | " ", 129 | " ", 130 | " "}; 131 | -------------------------------------------------------------------------------- /plugins/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Makefile.am 2 | ## 3 | ## Makefile.am for GlassCoder 'plugins/' 4 | ## 5 | ## (C) Copyright 2019-2024 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License as 9 | ## published by the Free Software Foundation; either version 2 of 10 | ## the License, or (at your option) any later version. 11 | ## 12 | ## This program is distributed in the hope that it will be useful, 13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ## GNU General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU General Public 18 | ## License along with this program; if not, write to the Free Software 19 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | ## 21 | ## Use automake to process this into a Makefile.in 22 | 23 | install-exec-am: 24 | mkdir -p $(DESTDIR)/usr/lib/rivendell/pypad 25 | cp pypad_glasscoder.exemplar $(DESTDIR)/usr/lib/rivendell/pypad/ 26 | ./install_pypad.sh pypad_glasscoder.py $(DESTDIR)/usr/lib/rivendell/pypad/pypad_glasscoder.py 27 | 28 | 29 | uninstall-local: 30 | rm -f $(DESTDIR)/usr/lib/rivendell/pypad/pypad_glasscoder.exemplar 31 | rm -f $(DESTDIR)/usr/lib/rivendell/pypad/pypad_glasscoder.py 32 | 33 | 34 | EXTRA_DIST = install_pypad.sh.in\ 35 | pypad_glasscoder.exemplar\ 36 | pypad_glasscoder.py 37 | 38 | 39 | CLEANFILES = *~\ 40 | *.idb\ 41 | *ilk\ 42 | *.obj\ 43 | *.pdb\ 44 | *.qm\ 45 | moc_* 46 | 47 | DISTCLEANFILES = install_pypad.sh 48 | 49 | MAINTAINERCLEANFILES = *~\ 50 | *.tar.gz\ 51 | aclocal.m4\ 52 | configure\ 53 | Makefile.in\ 54 | moc_* 55 | -------------------------------------------------------------------------------- /plugins/install_pypad.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # install_pypad.sh 4 | # 5 | # (C) Copyright 2019 Fred Gleason 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License version 2 as 9 | # published by the Free Software Foundation. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public 17 | # License along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | # 20 | 21 | cat $1 | sed -e s^%PYTHON_BANGPATH%^@PYTHON@^ > $2 22 | chmod 755 $2 23 | 24 | 25 | -------------------------------------------------------------------------------- /plugins/pypad_glasscoder.exemplar: -------------------------------------------------------------------------------- 1 | ; This is the sample configuration for the 'pypad_glasscoder.py' PyPAD script 2 | ; for Rivendell, which can be used to send articulated PAD updates to an 3 | ; instance of glasscoder(1). 4 | ; 5 | 6 | [Glasscoder] 7 | 8 | ; UpdateUrl=http://: 9 | ; 10 | ; The update URL of the GlassCoder instance, where: 11 | ; - The hostname or IP address of the system running 12 | ; glasscoder(1). 13 | ; - The number passed to the '--metadata-port=' switch 14 | ; when invoking glasscoder(1). 15 | ; 16 | ; N.B. - The above values refer to the GlassCoder instance, *not* the 17 | ; streaming server! 18 | UpdateUrl=http://192.168.21.21:1234 19 | 20 | ; Log Selection 21 | ; 22 | ; Set the status for each log to 'Yes', 'No' or 'Onair' to indicate whether 23 | ; state changes on that log should be output. If set to 'Onair', then 24 | ; output will be generated only if RDAirPlays OnAir flag is active. 25 | MasterLog=Yes 26 | Aux1Log=No 27 | Aux2Log=No 28 | VLog101=No 29 | VLog102=No 30 | VLog103=No 31 | VLog104=No 32 | VLog105=No 33 | VLog106=No 34 | VLog107=No 35 | VLog108=No 36 | VLog109=No 37 | VLog110=No 38 | VLog111=No 39 | VLog112=No 40 | VLog113=No 41 | VLog114=No 42 | VLog115=No 43 | VLog116=No 44 | VLog117=No 45 | VLog118=No 46 | VLog119=No 47 | VLog120=No 48 | 49 | ; 50 | ; This plug-in uses a concept of 'lines', where each [Line] section refers 51 | ; to a specific dynamic presentation field in the target stream's metadata 52 | ; scheme. Some streaming schemes have but one available dynamic field 53 | ; --e.g. IceCast-- and hence use just a single line section ('[Line1]'), 54 | ; while others have multiple fields and thus can use multiple line sections. 55 | ; 56 | ; See below for specific examples. 57 | ; 58 | 59 | ; 60 | ; An example of 'ICY-style' metadata (IceCast and Shoutcast) 61 | ; 62 | [Line1] 63 | Key=StreamTitle 64 | Value=%a - %t 65 | 66 | ; 67 | ; An example of HLS Timed Metadata 68 | ; 69 | ; The 'Key=' directive takes the name of the ID3v2.4 Text Identification 70 | ; Frame to use for the given value. For the full list of defined frames, 71 | ; see Section 4.2 of the ID3v2.4 spec, available at 72 | ; http://id3.org/id3v2.4.0-frames. 73 | ; 74 | ;[Line1] 75 | ;Key=TIT2 76 | ;Value=%t 77 | ; 78 | ;[Line2] 79 | ;Key=TPE1 80 | ;Value=%a 81 | ; 82 | ;[Line3] 83 | ;Key=TALB 84 | ;Value=%l 85 | ; 86 | ;[Line4] 87 | ;Key=TRSN 88 | ;Value=Rivendell 89 | ; 90 | ;[Line5] 91 | ;Key=TRSO 92 | ;Value=A Radio Automation System 93 | ; 94 | ;[Line6] 95 | ;Key=TFLT 96 | ;Value=MPG/AAC 97 | 98 | -------------------------------------------------------------------------------- /plugins/pypad_glasscoder.py: -------------------------------------------------------------------------------- 1 | #!%PYTHON_BANGPATH% 2 | 3 | # pypad_glasscoder.py 4 | # 5 | # Send articulated PAD updates to an instance of glasscoder(1). 6 | # 7 | # (C) Copyright 2019-2022 Fred Gleason 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License version 2 as 11 | # published by the Free Software Foundation. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public 19 | # License along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | # 22 | 23 | import sys 24 | import syslog 25 | import configparser 26 | try: 27 | from rivendellaudio import pypad 28 | except ModuleNotFoundError: 29 | import pypad # Rivendell v3.x style 30 | import json 31 | import requests 32 | 33 | def eprint(*args,**kwargs): 34 | print(*args,file=sys.stderr,**kwargs) 35 | 36 | def ProcessPad(update): 37 | if update.config().has_section('Glasscoder'): 38 | update_url=update.config().get('Glasscoder','UpdateUrl') 39 | n=1 40 | lines=[] 41 | section='Line'+str(n) 42 | while(update.config().has_section(section)): 43 | lines.append('"%s": "%s"' % (update.config().get(section,'Key'), update.resolvePadFields(update.config().get(section,'Value'),pypad.ESCAPE_JSON))) 44 | n=n+1 45 | section='Line'+str(n) 46 | 47 | if update.shouldBeProcessed('Glasscoder'): 48 | req_data='{ "Metadata": { %s } }' % ", ".join(lines) 49 | req_url = update_url+'/json_pad' 50 | try: 51 | r = requests.post(req_url, json=json.loads(req_data)) 52 | update.syslog(syslog.LOG_INFO,'[PyPAD][Glasscoder] Update exit code: ' + str(r.status_code)) 53 | except requests.exceptions.RequestException as e: 54 | update.syslog(syslog.LOG_WARNING,'[PyPAD][Glasscoder] Update failed: ' + str(e)) 55 | 56 | # 57 | # 'Main' function 58 | # 59 | rcvr=pypad.Receiver() 60 | try: 61 | rcvr.setConfigFile(sys.argv[3]) 62 | except IndexError: 63 | eprint('pypad_glasscoder.py: USAGE: cmd ') 64 | sys.exit(1) 65 | rcvr.setPadCallback(ProcessPad) 66 | rcvr.start(sys.argv[1],int(sys.argv[2])) 67 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## Automake.am for GlassCoder src/ 4 | ## 5 | ## (C) Copyright 2015 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License as 9 | ## published by the Free Software Foundation; either version 2 of 10 | ## the License, or (at your option) any later version. 11 | ## 12 | ## This program is distributed in the hope that it will be useful, 13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ## GNU General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU General Public 18 | ## License along with this program; if not, write to the Free Software 19 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | ## 21 | ## Use automake to process this into a Makefile.in 22 | 23 | SUBDIRS = common\ 24 | glasscoder\ 25 | glasscommander\ 26 | glassgui\ 27 | tests 28 | 29 | CLEANFILES = *~\ 30 | *.idb\ 31 | *ilk\ 32 | *.obj\ 33 | *.pdb\ 34 | *.qm\ 35 | moc_* 36 | 37 | MAINTAINERCLEANFILES = *~\ 38 | *.tar.gz\ 39 | aclocal.m4\ 40 | configure\ 41 | Makefile.in\ 42 | moc_* 43 | -------------------------------------------------------------------------------- /src/common/Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## Automake.am for GlassCoder src/common 4 | ## 5 | ## (C) Copyright 2015-2016 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License as 9 | ## published by the Free Software Foundation; either version 2 of 10 | ## the License, or (at your option) any later version. 11 | ## 12 | ## This program is distributed in the hope that it will be useful, 13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | ## GNU General Public License for more details. 16 | ## 17 | ## You should have received a copy of the GNU General Public 18 | ## License along with this program; if not, write to the Free Software 19 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | ## 21 | ## Use automake to process this into a Makefile.in 22 | 23 | EXTRA_DIST = asihpi.cpp asihpi.h\ 24 | audiodevice.cpp audiodevice.h\ 25 | cmdswitch.cpp cmdswitch.h\ 26 | codec.cpp codec.h\ 27 | codecdialog.cpp codecdialog.h\ 28 | codeviewer.cpp codeviewer.h\ 29 | combobox.cpp combobox.h\ 30 | connector.cpp connector.h\ 31 | glasslimits.h\ 32 | guiapplication.cpp guiapplication.h\ 33 | hpiinputlistview.cpp hpiinputlistview.h\ 34 | hpiwidget.cpp hpiwidget.h\ 35 | logging.cpp logging.h\ 36 | messagewidget.cpp messagewidget.h\ 37 | metaevent.cpp metaevent.h\ 38 | paths.h.in\ 39 | profile.cpp profile.h\ 40 | ringbuffer.cpp ringbuffer.h\ 41 | segmeter.cpp segmeter.h\ 42 | serverdialog.cpp serverdialog.h\ 43 | sourcedialog.cpp sourcedialog.h\ 44 | spinbox.cpp spinbox.h\ 45 | statuswidget.cpp statuswidget.h\ 46 | stereometer.cpp stereometer.h\ 47 | streamdialog.cpp streamdialog.h 48 | 49 | CLEANFILES = *~\ 50 | *.idb\ 51 | *ilk\ 52 | *.obj\ 53 | *.pdb\ 54 | *.qm\ 55 | moc_*\ 56 | paths.h 57 | 58 | MAINTAINERCLEANFILES = *~\ 59 | *.tar.gz\ 60 | aclocal.m4\ 61 | configure\ 62 | Makefile.in\ 63 | moc_* 64 | -------------------------------------------------------------------------------- /src/common/asihpi.cpp: -------------------------------------------------------------------------------- 1 | // asihpi.cpp 2 | // 3 | // Source Mappings for ASIHPI devices 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifdef ASIHPI 22 | #include 23 | #endif // ASIHPI 24 | 25 | #include "asihpi.h" 26 | 27 | // 28 | // Name Table 29 | // 30 | QString asihpi_common_source_names[]={"NONE", 31 | "OSTREAM", 32 | "LINEIN", 33 | "AESEBU", 34 | "TUNER", 35 | "RF", 36 | "CLOCK", 37 | "BITSTREAM", 38 | "MIC", 39 | "COBRANET", 40 | "ANALOG", 41 | "ADAPTER", 42 | "RTP", 43 | "INTERNAL", 44 | "AVB", 45 | "BLULINK"}; 46 | 47 | uint16_t AsihpiSourceNode(const QString &str) 48 | { 49 | uint16_t ret=0; 50 | 51 | #ifdef ASIHPI 52 | for(uint16_t i=HPI_SOURCENODE_NONE;i=HPI_SOURCENODE_NONE)&&(src 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef ASIHPI_H 22 | #define ASIHPI_H 23 | 24 | #include 25 | 26 | #include 27 | 28 | uint16_t AsihpiSourceNode(const QString &str); 29 | QString AsihpiSourceName(uint16_t src); 30 | 31 | 32 | #endif // ASIHPI_H 33 | -------------------------------------------------------------------------------- /src/common/audiodevice.h: -------------------------------------------------------------------------------- 1 | // audiodevice.h 2 | // 3 | // Abstract base class for audio input sources. 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef AUDIODEVICE_H 22 | #define AUDIODEVICE_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | #include "glasslimits.h" 30 | #include "ringbuffer.h" 31 | 32 | #define AUDIO_METER_INTERVAL 50 33 | 34 | class AudioDevice : public QObject 35 | { 36 | Q_OBJECT; 37 | public: 38 | enum DeviceType {Alsa=0,AsiHpi=1,File=2,Jack=3,LastType=4}; 39 | enum Format {FLOAT=0,S16_LE=1,S32_LE=2,LastFormat=3}; 40 | AudioDevice(unsigned chans,unsigned samprate, 41 | Ringbuffer *ring,QObject *parent=0); 42 | ~AudioDevice(); 43 | virtual bool isAvailable() const; 44 | virtual bool processOptions(QString *err,const QStringList &keys, 45 | const QStringList &values)=0; 46 | virtual bool start(QString *err)=0; 47 | virtual unsigned deviceSamplerate() const; 48 | void meterLevels(int *lvls) const; 49 | static QString deviceTypeText(AudioDevice::DeviceType type); 50 | static QString optionKeyword(AudioDevice::DeviceType type); 51 | static AudioDevice::DeviceType deviceType(const QString &key); 52 | static QString formatString(AudioDevice::Format fmt); 53 | 54 | signals: 55 | void hasStopped(); 56 | 57 | public slots: 58 | void unmute(); 59 | 60 | protected: 61 | void setMeterLevels(float *lvls); 62 | void setMeterLevels(int *lvls); 63 | void updateMeterLevels(int *lvls); 64 | Ringbuffer *ringBuffer(); 65 | unsigned channels() const; 66 | unsigned samplerate() const; 67 | void remixChannels(float *pcm_out,unsigned chans_out, 68 | float *pcm_in,unsigned chans_in,unsigned nframes); 69 | void convertToFloat(float *pcm_out,const void *pcm_in,Format fmt_in, 70 | unsigned nframes,unsigned chans); 71 | void peakLevels(float *lvls,const float *pcm,unsigned nframes,unsigned chans); 72 | void peakLevels(int *lvls,const float *pcm,unsigned nframes,unsigned chans); 73 | 74 | private: 75 | Ringbuffer *audio_ring; 76 | unsigned audio_channels; 77 | unsigned audio_samplerate; 78 | int audio_meter_levels[MAX_AUDIO_CHANNELS]; 79 | }; 80 | 81 | 82 | #endif // AUDIODEVICE_H 83 | -------------------------------------------------------------------------------- /src/common/cmdswitch.h: -------------------------------------------------------------------------------- 1 | // cmdswitch.h 2 | // 3 | // Process Command-Line Switches 4 | // 5 | // (C) Copyright 2012-2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef CMDSWITCH_H 22 | #define CMDSWITCH_H 23 | 24 | #include 25 | #include 26 | 27 | class CmdSwitch 28 | { 29 | public: 30 | CmdSwitch(const char *modname,const char *usage); 31 | unsigned keys() const; 32 | QString key(unsigned n) const; 33 | QString value(unsigned n) const; 34 | bool processed(unsigned n) const; 35 | void setProcessed(unsigned n,bool state); 36 | bool allProcessed() const; 37 | bool addOverlay(const QString &filename); 38 | 39 | private: 40 | std::vector switch_keys; 41 | std::vector switch_values; 42 | std::vector switch_processed; 43 | }; 44 | 45 | 46 | #endif // CMDSWITCH_H 47 | -------------------------------------------------------------------------------- /src/common/codec.h: -------------------------------------------------------------------------------- 1 | // codec.h 2 | // 3 | // Abstract base class for audio codecs. 4 | // 5 | // (C) Copyright 2014-2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef CODEC_H 22 | #define CODEC_H 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #include 33 | #include 34 | 35 | #include "connector.h" 36 | #include "glasslimits.h" 37 | #include "ringbuffer.h" 38 | 39 | #define MAX_AUDIO_BUFFER 4096 40 | 41 | class Codec : public QObject 42 | { 43 | Q_OBJECT; 44 | public: 45 | enum Type {TypeFdk=0,TypeMpegL2=1,TypeMpegL3=2, 46 | TypeVorbis=3,TypePcm16=4,TypeOpus=5,TypeLast=6}; 47 | Codec(Codec::Type type,Ringbuffer *ring,QObject *parent=0); 48 | ~Codec(); 49 | unsigned bitrate() const; 50 | void setBitrate(unsigned rate); 51 | unsigned channels() const; 52 | void setChannels(unsigned chans); 53 | double quality() const; 54 | void setQuality(double qual); 55 | unsigned sourceSamplerate() const; 56 | void setSourceSamplerate(unsigned rate); 57 | unsigned streamSamplerate() const; 58 | void setStreamSamplerate(unsigned rate); 59 | bool completeFrames() const; 60 | void setCompleteFrames(bool state); 61 | virtual QByteArray streamPrologue() const; 62 | virtual bool isAvailable() const=0; 63 | virtual QString contentType() const=0; 64 | virtual unsigned pcmFrames() const=0; 65 | virtual QString defaultExtension() const=0; 66 | virtual QString formatIdentifier() const=0; 67 | virtual bool start(); 68 | static QString codecTypeText(Codec::Type type); 69 | static QString optionKeyword(Codec::Type type); 70 | static Codec::Type codecType(const QString &key); 71 | 72 | public slots: 73 | virtual void encode(Connector *conn); 74 | 75 | protected: 76 | virtual void encodeData(Connector *conn,const float *pcm,int len)=0; 77 | virtual bool startCodec()=0; 78 | Ringbuffer *ring(); 79 | 80 | private: 81 | Ringbuffer *codec_ring1; 82 | Ringbuffer *codec_ring2; 83 | unsigned codec_bitrate; 84 | unsigned codec_channels; 85 | double codec_quality; 86 | unsigned codec_source_samplerate; 87 | unsigned codec_stream_samplerate; 88 | bool codec_complete_frames; 89 | SRC_STATE *codec_src_state; 90 | SRC_DATA *codec_src_data; 91 | float *codec_pcm_in; 92 | float *codec_pcm_out; 93 | float *codec_pcm_buffer[2]; 94 | }; 95 | 96 | 97 | #endif // CODEC_H 98 | -------------------------------------------------------------------------------- /src/common/codecdialog.h: -------------------------------------------------------------------------------- 1 | // codecdialog.h 2 | // 3 | // Configuration dialog for codec settings 4 | // 5 | // (C) Copyright 2015-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef CODECDIALOG_H 22 | #define CODECDIALOG_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "codec.h" 34 | #include "combobox.h" 35 | #include "profile.h" 36 | 37 | class CodecDialog : public QDialog 38 | { 39 | Q_OBJECT; 40 | public: 41 | CodecDialog(const QString &caption,QWidget *parent); 42 | QSize sizeHint() const; 43 | void setControlsLocked(bool state); 44 | void makeArgs(QStringList *args); 45 | void addCodecTypes(const QString &types); 46 | void load(Profile *p); 47 | void save(FILE *f); 48 | 49 | protected: 50 | void resizeEvent(QResizeEvent *e); 51 | 52 | private slots: 53 | void codecTypeChanged(int n); 54 | void codecSamplerateChanged(int n); 55 | 56 | private: 57 | QLabel *gui_codec_type_label; 58 | ComboBox *gui_codec_type_box; 59 | QLabel *gui_codec_samplerate_label; 60 | ComboBox *gui_codec_samplerate_box; 61 | QLabel *gui_codec_channels_label; 62 | ComboBox *gui_codec_channels_box; 63 | QLabel *gui_codec_bitrate_label; 64 | ComboBox *gui_codec_bitrate_box; 65 | QPushButton *gui_close_button; 66 | QString gui_caption; 67 | }; 68 | 69 | 70 | #endif // CODECDIALOG_H 71 | -------------------------------------------------------------------------------- /src/common/codeviewer.cpp: -------------------------------------------------------------------------------- 1 | // codeviewer.cpp 2 | // 3 | // Text viewer dialog 4 | // 5 | // (C) Copyright 2015-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "codeviewer.h" 22 | 23 | CodeViewer::CodeViewer(const QString &caption,QWidget *parent) 24 | : QDialog(parent) 25 | { 26 | view_caption=caption; 27 | 28 | setWindowTitle(view_caption+" - "+tr("View Code")); 29 | 30 | QFont button_font(font().family(),font().pointSize(),QFont::Bold); 31 | 32 | view_text=new QTextEdit(this); 33 | view_text->setReadOnly(true); 34 | 35 | view_close_button=new QPushButton(tr("Close"),this); 36 | view_close_button->setFont(button_font); 37 | connect(view_close_button,SIGNAL(clicked()),this,SLOT(closeData())); 38 | } 39 | 40 | 41 | QSize CodeViewer::sizeHint() const 42 | { 43 | return QSize(600,400); 44 | } 45 | 46 | 47 | int CodeViewer::exec(const QString &str) 48 | { 49 | view_text->setText(str); 50 | return QDialog::exec(); 51 | } 52 | 53 | 54 | int CodeViewer::exec(const QStringList &strs) 55 | { 56 | view_text->setText(strs.join(" \\\n")); 57 | return QDialog::exec(); 58 | } 59 | 60 | 61 | void CodeViewer::resizeEvent(QResizeEvent *e) 62 | { 63 | view_text->setGeometry(10,10,size().width()-20,size().height()-55); 64 | view_close_button->setGeometry(size().width()-70,size().height()-35,60,25); 65 | } 66 | 67 | 68 | void CodeViewer::closeData() 69 | { 70 | done(0); 71 | } 72 | -------------------------------------------------------------------------------- /src/common/codeviewer.h: -------------------------------------------------------------------------------- 1 | // codeviewer.h 2 | // 3 | // Text viewer dialog 4 | // 5 | // (C) Copyright 2015-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef CODEVIEWER_H 22 | #define CODEVIEWER_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | class CodeViewer : public QDialog 31 | { 32 | Q_OBJECT; 33 | public: 34 | CodeViewer(const QString &caption,QWidget *parent); 35 | QSize sizeHint() const; 36 | 37 | public slots: 38 | int exec(const QString &str); 39 | int exec(const QStringList &strs); 40 | 41 | protected: 42 | void resizeEvent(QResizeEvent *e); 43 | 44 | private slots: 45 | void closeData(); 46 | 47 | private: 48 | QTextEdit *view_text; 49 | QPushButton *view_close_button; 50 | QString view_caption; 51 | }; 52 | 53 | 54 | #endif // CODEVIEWER_H 55 | -------------------------------------------------------------------------------- /src/common/combobox.cpp: -------------------------------------------------------------------------------- 1 | // combobox.cpp 2 | // 3 | // ComboBox widget for GlassGui 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | 23 | #include "combobox.h" 24 | 25 | ComboBox::ComboBox(QWidget *parent) 26 | : QComboBox(parent) 27 | { 28 | box_read_only=false; 29 | } 30 | 31 | 32 | void ComboBox::setReadOnly(bool state) 33 | { 34 | box_read_only=state; 35 | } 36 | 37 | 38 | QVariant ComboBox::currentItemData(int role) 39 | { 40 | return itemData(currentIndex(),role); 41 | } 42 | 43 | 44 | bool ComboBox::setCurrentItemData(unsigned val) 45 | { 46 | for(int i=0;iaccept(); 60 | } 61 | else { 62 | QComboBox::keyPressEvent(e); 63 | } 64 | } 65 | 66 | 67 | void ComboBox::mousePressEvent(QMouseEvent *e) 68 | { 69 | if(box_read_only) { 70 | e->accept(); 71 | } 72 | else { 73 | QComboBox::mousePressEvent(e); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/common/combobox.h: -------------------------------------------------------------------------------- 1 | // combobox.h 2 | // 3 | // ComboBox widget for GlassGui 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef COMBOBOX_H 22 | #define COMBOBOX_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class ComboBox : public QComboBox 29 | { 30 | Q_OBJECT; 31 | public: 32 | ComboBox(QWidget *parent=0); 33 | void setReadOnly(bool state); 34 | QVariant currentItemData(int role=Qt::UserRole); 35 | bool setCurrentItemData(unsigned val); 36 | 37 | protected: 38 | void keyPressEvent(QKeyEvent *e); 39 | void mousePressEvent(QMouseEvent *e); 40 | 41 | private: 42 | bool box_read_only; 43 | }; 44 | 45 | 46 | #endif // COMBOBOX_H 47 | -------------------------------------------------------------------------------- /src/common/glasslimits.h: -------------------------------------------------------------------------------- 1 | // glasslimits.h 2 | // 3 | // System-wide limits and settings for GlassCoder 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef GLASSLIMITS_H 22 | #define GLASSLIMITS_H 23 | 24 | #define DEFAULT_SERVER_PORT 80 25 | #define DEFAULT_AUDIO_BITRATE 128 26 | #define DEFAULT_AUDIO_SAMPLERATE 44100 27 | #define DEFAULT_AUDIO_DEVICE AudioDevice::Jack 28 | #define MAX_AUDIO_CHANNELS 2 29 | #define RINGBUFFER_SIZE 262144 30 | #define PROCESS_TERMINATION_TIMEOUT 30000 31 | 32 | #endif // GLASSLIMITS_H 33 | -------------------------------------------------------------------------------- /src/common/guiapplication.cpp: -------------------------------------------------------------------------------- 1 | // guiapplication.cpp 2 | // 3 | // Abstract base class for GUI applications in GlassCoder 4 | // 5 | // (C) Copyright 2015-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | #include "guiapplication.h" 28 | 29 | GuiApplication::GuiApplication(QWidget *parent) 30 | : QMainWindow(parent) 31 | { 32 | gui_settings_path=""; 33 | gui_settings_dir=NULL; 34 | checkSettingsDirectory(); 35 | } 36 | 37 | 38 | QDir *GuiApplication::settingsDirectory() const 39 | { 40 | return gui_settings_dir; 41 | } 42 | 43 | 44 | bool GuiApplication::setSettingsDirectory(const QString &dirname) 45 | { 46 | gui_settings_path=dirname; 47 | return checkSettingsDirectory(); 48 | } 49 | 50 | 51 | bool GuiApplication::checkSettingsDirectory() 52 | { 53 | QString path; 54 | 55 | if(gui_settings_path.isEmpty()) { 56 | path=QString("/")+GUI_SETTINGS_DIR; 57 | if(getenv("HOME")!=NULL) { 58 | path=QString(getenv("HOME"))+"/"+GUI_SETTINGS_DIR; 59 | } 60 | } 61 | else { 62 | path=gui_settings_path; 63 | } 64 | if((gui_settings_dir==NULL)||(gui_settings_dir->path()!=path)) { 65 | gui_settings_dir=new QDir(path); 66 | } 67 | if(!gui_settings_dir->exists()) { 68 | mkdir(path.toUtf8(),S_IRUSR|S_IWUSR|S_IXUSR); 69 | if(!gui_settings_dir->exists()) { 70 | return false; 71 | } 72 | } 73 | return true; 74 | } 75 | 76 | 77 | QString GuiApplication::settingsFilename(const QString &instance_name) 78 | { 79 | if(!checkSettingsDirectory()) { 80 | QMessageBox::critical(this,"GlassGui - "+tr("Error"), 81 | tr("Unable to create settings directory!")); 82 | exit(256); 83 | } 84 | QString ret=gui_settings_dir->path()+"/"+GUI_SETTINGS_FILE; 85 | if(!instance_name.isEmpty()) { 86 | ret+="-"+instance_name; 87 | } 88 | 89 | return ret; 90 | } 91 | 92 | 93 | void GuiApplication::deleteInstance(const QString &name) 94 | { 95 | if(checkSettingsDirectory()) { 96 | unlink((gui_settings_dir->path()+"/"+GUI_SETTINGS_FILE+"-"+name).toUtf8()); 97 | } 98 | } 99 | 100 | 101 | QStringList GuiApplication::listInstances() 102 | { 103 | QStringList files; 104 | QStringList ret; 105 | if(checkSettingsDirectory()) { 106 | files=gui_settings_dir-> 107 | entryList(QStringList(QString(GUI_SETTINGS_FILE)+"-*"), 108 | QDir::Files,QDir::Name); 109 | for(int i=0;i 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef GUIAPPLICATION_H 22 | #define GUIAPPLICATION_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #define GUI_SETTINGS_DIR ".glassgui" 29 | #define GUI_SETTINGS_FILE "glassguirc" 30 | 31 | class GuiApplication : public QMainWindow 32 | { 33 | Q_OBJECT; 34 | public: 35 | GuiApplication(QWidget *parent=0); 36 | 37 | protected: 38 | QDir *settingsDirectory() const; 39 | bool setSettingsDirectory(const QString &dirname); 40 | bool checkSettingsDirectory(); 41 | QString settingsFilename(const QString &instance_name); 42 | void deleteInstance(const QString &name); 43 | QStringList listInstances(); 44 | 45 | private: 46 | QString gui_settings_path; 47 | QDir *gui_settings_dir; 48 | }; 49 | 50 | 51 | #endif // GUIAPPLICATION_H 52 | -------------------------------------------------------------------------------- /src/common/hpiinputlistview.h: -------------------------------------------------------------------------------- 1 | // hpiinputlistview.h 2 | // 3 | // List widget for selecting HPI input streams 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef HPIINPUTLISTVIEW_H 22 | #define HPIINPUTLISTVIEW_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | class HpiInputListViewModel : public QAbstractListModel 31 | { 32 | public: 33 | enum UserRole {AdapterRole=Qt::UserRole,InputRole=Qt::UserRole+1}; 34 | HpiInputListViewModel(QObject *parent=0); 35 | int rowCount(const QModelIndex &parent=QModelIndex()) const; 36 | QVariant data(const QModelIndex &index,int role=Qt::DisplayRole) const; 37 | 38 | private: 39 | std::vector hpi_input_names; 40 | std::vector hpi_adapter_indices; 41 | std::vector hpi_input_indices; 42 | }; 43 | 44 | class HpiInputListView : public QListView 45 | { 46 | Q_OBJECT; 47 | public: 48 | HpiInputListView(QWidget *parent); 49 | void setReadOnly(bool state); 50 | unsigned selectedAdapterIndex() const; 51 | unsigned selectedInputIndex() const; 52 | void setSelected(unsigned adapter,unsigned input); 53 | 54 | signals: 55 | void inputSelected(unsigned adapter,unsigned input); 56 | 57 | protected: 58 | void keyPressEvent(QKeyEvent *e); 59 | void mouseMoveEvent(QMouseEvent *e); 60 | void mousePressEvent(QMouseEvent *e); 61 | 62 | private: 63 | HpiInputListViewModel *hpi_model; 64 | bool hpi_read_only; 65 | }; 66 | 67 | #endif // HPIINPUTLISTVIEW_H 68 | -------------------------------------------------------------------------------- /src/common/hpiwidget.h: -------------------------------------------------------------------------------- 1 | // hpiwidget.h 2 | // 3 | // Widget for configuring ASIHPI sources 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef HPIWIDGET_H 22 | #define HPIWIDGET_H 23 | 24 | #include 25 | #include 26 | 27 | #ifdef ASIHPI 28 | #include 29 | #endif // ASIHPI 30 | 31 | #include 32 | #include 33 | 34 | #include "combobox.h" 35 | #include "hpiinputlistview.h" 36 | 37 | #define ASIHPI_PACK_CONTROL(type,index) ((0xFFFF&(type))<<16)|(0xFFFF&(index)) 38 | #define ASIHPI_UNPACK_TYPE(value) (((value)>>16)&0xFFFF) 39 | #define ASIHPI_UNPACK_INDEX(value) ((value)&0xFFFF) 40 | 41 | class HpiWidget : public QWidget 42 | { 43 | Q_OBJECT; 44 | public: 45 | HpiWidget(QWidget *parent=0); 46 | void setReadOnly(bool state); 47 | unsigned selectedAdapterIndex() const; 48 | unsigned selectedInputIndex() const; 49 | void setSelected(unsigned adapter,unsigned input); 50 | int inputGain() const; 51 | void setInputGain(int gain); 52 | unsigned channelMode() const; 53 | void setChannelMode(unsigned mode); 54 | unsigned inputSource() const; 55 | void setInputSource(unsigned src); 56 | unsigned inputType() const; 57 | void setInputType(unsigned type); 58 | static QString sourceNodeText(uint16_t src_node); 59 | static QString channelModeText(uint16_t mode); 60 | 61 | protected: 62 | void resizeEvent(QResizeEvent *e); 63 | 64 | private slots: 65 | void listClickedData(const QModelIndex &index); 66 | void sourceActivatedData(int n); 67 | void typeActivatedData(int n); 68 | void modeActivatedData(int n); 69 | void volumeChangedData(int level); 70 | 71 | private: 72 | #ifdef ASIHPI 73 | void LoadMixer(unsigned adapter,unsigned input); 74 | void Redraw(); 75 | hpi_err_t HpiLog(hpi_err_t err,int priority=LOG_DEBUG) const; 76 | const char *hpi_strerror(hpi_err_t err) const; 77 | HpiInputListView *hpi_view; 78 | QLabel *hpi_source_label; 79 | ComboBox *hpi_source_box; 80 | QLabel *hpi_mode_label; 81 | ComboBox *hpi_mode_box; 82 | QLabel *hpi_type_label; 83 | ComboBox *hpi_type_box; 84 | QLabel *hpi_volume_label; 85 | QSlider *hpi_volume_slider; 86 | QLabel *hpi_volume_readout_label; 87 | unsigned hpi_adapter_index; 88 | unsigned hpi_input_index; 89 | uint32_t hpi_mixer_handle; 90 | hpi_handle_t hpi_mult_handle; 91 | bool hpi_mult_found; 92 | hpi_handle_t hpi_type_handle; 93 | bool hpi_type_found; 94 | hpi_handle_t hpi_mode_handle; 95 | bool hpi_mode_found; 96 | hpi_handle_t hpi_volume_handle; 97 | bool hpi_volume_found; 98 | #endif // ASIHPI 99 | }; 100 | 101 | 102 | #endif // HPIWIDGET_H 103 | -------------------------------------------------------------------------------- /src/common/logging.cpp: -------------------------------------------------------------------------------- 1 | // logging.cpp 2 | // 3 | // Logging routines for glasscoder(1). 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | #include 23 | 24 | #include "logging.h" 25 | 26 | int global_log_to=LOG_TO_STDERR; 27 | QString global_log_string; 28 | bool global_log_verbose=false; 29 | 30 | void Log(int prio,const QString &msg) 31 | { 32 | QString sysmsg=msg; 33 | if(!global_log_string.isEmpty()) { 34 | sysmsg="["+global_log_string+"] "+msg; 35 | } 36 | 37 | switch(global_log_to) { 38 | case LOG_TO_SYSLOG: 39 | syslog(prio,"%s",sysmsg.toUtf8().constData()); 40 | break; 41 | 42 | case LOG_TO_STDOUT: 43 | if(global_log_verbose||(prio 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | 23 | #include 24 | 25 | #define LOG_TO_STDERR 0 26 | #define LOG_TO_SYSLOG 1 27 | #define LOG_TO_STDOUT 2 28 | 29 | #define CONNECTION_IDLE 0 30 | #define CONNECTION_PENDING 1 31 | #define CONNECTION_OK 2 32 | #define CONNECTION_FAILED 3 33 | #define CONNECTION_STOPPING 4 34 | 35 | extern int global_log_to; 36 | extern QString global_log_string; 37 | extern bool global_log_verbose; 38 | 39 | void Log(int prio,const QString &msg); 40 | -------------------------------------------------------------------------------- /src/common/messagewidget.cpp: -------------------------------------------------------------------------------- 1 | // messagewidget.cpp 2 | // 3 | // Connection message widget 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | 23 | #include "messagewidget.h" 24 | 25 | MessageWidget::MessageWidget(QWidget *parent) 26 | : QLabel(parent) 27 | { 28 | msg_hang_timer=new QTimer(this); 29 | msg_hang_timer->setSingleShot(true); 30 | connect(msg_hang_timer,SIGNAL(timeout()),this,SLOT(hangData())); 31 | } 32 | 33 | 34 | MessageWidget::~MessageWidget() 35 | { 36 | delete msg_hang_timer; 37 | } 38 | 39 | 40 | void MessageWidget::addMessage(const QString &msg) 41 | { 42 | msg_messages.push(msg); 43 | if(!msg_hang_timer->isActive()) { 44 | msg_hang_timer->start(0); 45 | } 46 | } 47 | 48 | 49 | void MessageWidget::hangData() 50 | { 51 | if(msg_messages.size()>0) { 52 | setText(msg_messages.front()); 53 | msg_messages.pop(); 54 | msg_hang_timer->start(MESSAGEWIDGET_HANG_TIME); 55 | } 56 | else { 57 | setText(""); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/common/messagewidget.h: -------------------------------------------------------------------------------- 1 | // messagewidget.h 2 | // 3 | // Connection message widget 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef MESSAGEWIDGET_H 22 | #define MESSAGEWIDGET_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | #define MESSAGEWIDGET_HANG_TIME 5000 30 | 31 | class MessageWidget : public QLabel 32 | { 33 | Q_OBJECT; 34 | public: 35 | MessageWidget(QWidget *parent=0); 36 | ~MessageWidget(); 37 | void addMessage(const QString &msg); 38 | 39 | private slots: 40 | void hangData(); 41 | 42 | private: 43 | std::queue msg_messages; 44 | QTimer *msg_hang_timer; 45 | }; 46 | 47 | 48 | #endif // MESSAGEWIDGET_H 49 | -------------------------------------------------------------------------------- /src/common/metaevent.cpp: -------------------------------------------------------------------------------- 1 | // metaevent.cpp 2 | // 3 | // Container class for metadata updates. 4 | // 5 | // (C) Copyright 2016-2019 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | 23 | #include "metaevent.h" 24 | 25 | MetaEvent::MetaEvent() 26 | { 27 | } 28 | 29 | 30 | MetaEvent::MetaEvent(const MetaEvent &e) 31 | { 32 | meta_fields=e.meta_fields; 33 | } 34 | 35 | 36 | QStringList MetaEvent::fieldKeys() const 37 | { 38 | QStringList keys; 39 | 40 | for(QMap::const_iterator it=meta_fields.begin(); 41 | it!=meta_fields.end();it++) { 42 | keys.push_back(it.key()); 43 | } 44 | 45 | return keys; 46 | } 47 | 48 | 49 | QString MetaEvent::field(const QString &key,bool *ok) const 50 | { 51 | if(ok!=NULL) { 52 | *ok=meta_fields.find(key)!=meta_fields.end(); 53 | } 54 | 55 | return meta_fields.value(key,QString()); 56 | } 57 | 58 | 59 | void MetaEvent::setField(const QString &key,const QString &v) 60 | { 61 | QString mkey=key; 62 | QString mv=v; 63 | if(key=="TXXX") { 64 | int index=v.indexOf("]"); 65 | if(index>=2) { 66 | QString subkey=v.mid(1,v.indexOf("]")-1); 67 | mkey=key+subkey; 68 | mv=v.right(v.length()-index-2); 69 | } 70 | } 71 | meta_fields[mkey]=mv; 72 | } 73 | 74 | 75 | QString MetaEvent::exportFields() const 76 | { 77 | QString ret=""; 78 | 79 | for(QMap::const_iterator it=meta_fields.begin(); 80 | it!=meta_fields.end();it++) { 81 | QString value=it.value(); 82 | ret+="Metadata|"+it.key()+":"+value+"\n"; 83 | } 84 | 85 | return ret; 86 | } 87 | 88 | 89 | bool MetaEvent::isEmpty() const 90 | { 91 | return meta_fields.size()==0; 92 | } 93 | 94 | 95 | QString MetaEvent::dump() const 96 | { 97 | QString str=""; 98 | 99 | for(QMap::const_iterator it=meta_fields.begin(); 100 | it!=meta_fields.end();it++) { 101 | str+=it.key()+": "+it.value()+"\n"; 102 | } 103 | 104 | return str; 105 | } 106 | 107 | 108 | void MetaEvent::clear() 109 | { 110 | meta_fields.clear(); 111 | } 112 | 113 | -------------------------------------------------------------------------------- /src/common/metaevent.h: -------------------------------------------------------------------------------- 1 | // metaevent.h 2 | // 3 | // Container class for metadata updates. 4 | // 5 | // (C) Copyright 2016-2019 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef METAEVENT_H 22 | #define METAEVENT_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | class MetaEvent 31 | { 32 | public: 33 | MetaEvent(); 34 | MetaEvent(const MetaEvent &e); 35 | QStringList fieldKeys() const; 36 | QString field(const QString &key,bool *ok=NULL) const; 37 | void setField(const QString &key,const QString &v); 38 | QString exportFields() const; 39 | bool isEmpty() const; 40 | QString dump() const; 41 | void clear(); 42 | 43 | private: 44 | QMap meta_fields; 45 | }; 46 | 47 | 48 | #endif // METAEVENT_H 49 | -------------------------------------------------------------------------------- /src/common/paths.h.in: -------------------------------------------------------------------------------- 1 | // paths.h 2 | // 3 | // Build-specific settings for GlassCoder 4 | // 5 | // (C) Copyright 2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef PATHS_H 22 | #define PATHS_H 23 | 24 | #define GLASSCODER_PREFIX QString("@LOCAL_PREFIX@") 25 | 26 | 27 | #endif // PATHS_H 28 | -------------------------------------------------------------------------------- /src/common/profile.h: -------------------------------------------------------------------------------- 1 | // profile.h 2 | // 3 | // Class for reading INI configuration files. 4 | // 5 | // (C) Copyright 2013 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef PROFILE_H 22 | #define PROFILE_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | class ProfileLine 31 | { 32 | public: 33 | ProfileLine(); 34 | QString tag() const; 35 | void setTag(QString tag); 36 | QString value() const; 37 | void setValue(QString value); 38 | void clear(); 39 | 40 | private: 41 | QString line_tag; 42 | QString line_value; 43 | }; 44 | 45 | 46 | class ProfileSection 47 | { 48 | public: 49 | ProfileSection(); 50 | QString name() const; 51 | void setName(QString name); 52 | bool getValue(QString tag,QString *value) const; 53 | void addValue(QString tag,QString value); 54 | void clear(); 55 | 56 | private: 57 | QString section_name; 58 | std::vector section_line; 59 | }; 60 | 61 | 62 | class Profile 63 | { 64 | public: 65 | Profile(); 66 | QString source() const; 67 | bool setSource(const QString &filename); 68 | bool setSource(std::vector *values); 69 | QString stringValue(const QString §ion,const QString &tag, 70 | const QString &default_value="",bool *ok=0) const; 71 | int intValue(const QString §ion,const QString &tag, 72 | int default_value=0,bool *ok=0) const; 73 | int hexValue(const QString §ion,const QString &tag, 74 | int default_value=0,bool *ok=0) const; 75 | float floatValue(const QString §ion,const QString &tag, 76 | float default_value=0.0,bool *ok=0) const; 77 | double doubleValue(const QString §ion,const QString &tag, 78 | double default_value=0.0,bool *ok=0) const; 79 | bool boolValue(const QString §ion,const QString &tag, 80 | bool default_value=false,bool *ok=0) const; 81 | QTime timeValue(const QString §ion,const QString &tag, 82 | const QTime &default_value=QTime(),bool *ok=0); 83 | QHostAddress addressValue(const QString §ion,const QString &tag, 84 | const QHostAddress &default_value=QHostAddress(), 85 | bool *ok=0); 86 | QHostAddress addressValue(const QString §ion,const QString &tag, 87 | const QString &default_value="",bool *ok=0); 88 | void clear(); 89 | 90 | private: 91 | QString profile_source; 92 | std::vector profile_section; 93 | }; 94 | 95 | 96 | #endif // PROFILE_H 97 | -------------------------------------------------------------------------------- /src/common/ringbuffer.h: -------------------------------------------------------------------------------- 1 | // ringbuffer.h 2 | // 3 | // A ringbuffer class for PCM audio 4 | // 5 | // (C) Copyright 2011-2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU Library General Public License 9 | // version 2 as published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | // ISO/POSIX C version of Paul Davis's lock free ringbuffer C++ code. 21 | // This is safe for the case of one read thread and one write thread. 22 | // 23 | // Copyright (C) 2000 Paul Davis 24 | // Copyright (C) 2003 Rohan Drape 25 | // 26 | 27 | #ifndef RINGBUFFER_H 28 | #define RINGBUFFER_H 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" 34 | { 35 | #endif 36 | 37 | typedef struct { 38 | char *buf; 39 | size_t len; 40 | } 41 | glass_ringbuffer_data_t ; 42 | 43 | typedef struct { 44 | char *buf; 45 | volatile size_t write_ptr; 46 | volatile size_t read_ptr; 47 | size_t size; 48 | size_t size_mask; 49 | int mlocked; 50 | } 51 | glass_ringbuffer_t ; 52 | glass_ringbuffer_t *glass_ringbuffer_create(int sz); 53 | void glass_ringbuffer_free(glass_ringbuffer_t *rb); 54 | void glass_ringbuffer_get_read_vector(const glass_ringbuffer_t *rb, 55 | glass_ringbuffer_data_t *vec); 56 | void glass_ringbuffer_get_write_vector(const glass_ringbuffer_t *rb, 57 | glass_ringbuffer_data_t *vec); 58 | size_t glass_ringbuffer_read(glass_ringbuffer_t *rb, char *dest, size_t cnt); 59 | size_t glass_ringbuffer_peek(glass_ringbuffer_t *rb, char *dest, size_t cnt); 60 | void glass_ringbuffer_read_advance(glass_ringbuffer_t *rb, size_t cnt); 61 | size_t glass_ringbuffer_read_space(const glass_ringbuffer_t *rb); 62 | int glass_ringbuffer_mlock(glass_ringbuffer_t *rb); 63 | void glass_ringbuffer_reset(glass_ringbuffer_t *rb); 64 | void glass_ringbuffer_reset_size (glass_ringbuffer_t * rb, size_t sz); 65 | size_t glass_ringbuffer_write(glass_ringbuffer_t *rb, const char *src, 66 | size_t cnt); 67 | void glass_ringbuffer_write_advance(glass_ringbuffer_t *rb, size_t cnt); 68 | size_t glass_ringbuffer_write_space(const glass_ringbuffer_t *rb); 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | class Ringbuffer 75 | { 76 | public: 77 | Ringbuffer(size_t bytes,unsigned channels); 78 | ~Ringbuffer(); 79 | unsigned size() const; 80 | unsigned read(float *data,unsigned frames); 81 | unsigned readSpace() const; 82 | unsigned write(float *data,unsigned frames); 83 | unsigned writeSpace() const; 84 | unsigned dump(unsigned frames); 85 | 86 | private: 87 | glass_ringbuffer_t *ring_ring; 88 | unsigned ring_channels; 89 | }; 90 | 91 | 92 | #endif // RINGBUFFER_H 93 | -------------------------------------------------------------------------------- /src/common/serverdialog.h: -------------------------------------------------------------------------------- 1 | // serverdialog.h 2 | // 3 | // Configuration dialog for server settings 4 | // 5 | // (C) Copyright 2015-2025 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef SERVERDIALOG_H 22 | #define SERVERDIALOG_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #include "combobox.h" 37 | #include "connector.h" 38 | #include "profile.h" 39 | 40 | class ServerDialog : public QDialog 41 | { 42 | Q_OBJECT; 43 | public: 44 | ServerDialog(QDir *temp_dir,const QString &caption,QWidget *parent); 45 | QSize sizeHint() const; 46 | bool makeArgs(QStringList *args,bool escape_args); 47 | bool writeCredentials() const; 48 | void setControlsLocked(bool state); 49 | QString credentialsFilename() const; 50 | void load(Profile *p); 51 | void save(FILE *f); 52 | 53 | signals: 54 | void typeChanged(Connector::ServerType type); 55 | void settingsChanged(); 56 | 57 | protected: 58 | void resizeEvent(QResizeEvent *e); 59 | 60 | private slots: 61 | void serverTypeChanged(int index); 62 | void locationChanged(const QString &str); 63 | void useIdentityChanged(bool state); 64 | void selectIdentityFile(); 65 | 66 | private: 67 | QLabel *srv_server_label; 68 | QLabel *srv_server_type_label; 69 | ComboBox *srv_server_type_box; 70 | QCheckBox *srv_verbose_check; 71 | QLabel *srv_verbose_label; 72 | QLabel *srv_server_location_label; 73 | QLineEdit *srv_server_location_edit; 74 | QLabel *srv_server_username_label; 75 | QLineEdit *srv_server_username_edit; 76 | QLabel *srv_server_password_label; 77 | QLineEdit *srv_server_password_edit; 78 | QCheckBox *srv_use_identity_check; 79 | QLabel *srv_use_identity_label; 80 | QLabel *srv_identity_label; 81 | QLineEdit *srv_identity_edit; 82 | QPushButton *srv_identity_button; 83 | QLabel *srv_server_script_up_label; 84 | QLineEdit *srv_server_script_up_edit; 85 | QLabel *srv_server_script_down_label; 86 | QLineEdit *srv_server_script_down_edit; 87 | QLabel *srv_server_metadata_port_label; 88 | QSpinBox *srv_server_metadata_port_spin; 89 | QLabel *srv_server_maxconns_label; 90 | QSpinBox *srv_server_maxconns_spin; 91 | QCheckBox *srv_cleanup_check; 92 | QLabel *srv_cleanup_label; 93 | QCheckBox *srv_preclean_check; 94 | QLabel *srv_preclean_label; 95 | QPushButton *srv_close_button; 96 | QDir *srv_temp_dir; 97 | QString srv_identity_path; 98 | QString srv_caption; 99 | }; 100 | 101 | 102 | #endif // SERVERDIALOG_H 103 | -------------------------------------------------------------------------------- /src/common/sourcedialog.h: -------------------------------------------------------------------------------- 1 | // sourcedialog.h 2 | // 3 | // Configuration dialog for source settings 4 | // 5 | // (C) Copyright 2015-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef SOURCEDIALOG_H 22 | #define SOURCEDIALOG_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include "audiodevice.h" 35 | #include "combobox.h" 36 | #include "hpiwidget.h" 37 | #include "profile.h" 38 | 39 | class SourceDialog : public QDialog 40 | { 41 | Q_OBJECT; 42 | public: 43 | SourceDialog(const QString &caption,QWidget *parent); 44 | QSize sizeHint() const; 45 | bool makeArgs(QStringList *args,bool escape_args); 46 | void setControlsLocked(bool state); 47 | void addSourceTypes(const QString &types); 48 | void load(Profile *p); 49 | void save(FILE *f); 50 | 51 | public slots: 52 | void show(); 53 | 54 | signals: 55 | void updated(); 56 | 57 | protected: 58 | void resizeEvent(QResizeEvent *e); 59 | 60 | private slots: 61 | void sourceTypeChanged(int n); 62 | void fileSelectName(); 63 | void checkArgs(const QString &str); 64 | 65 | private: 66 | void ChangeSize(); 67 | 68 | QLabel *gui_source_type_label; 69 | ComboBox *gui_source_type_box; 70 | 71 | QLabel *gui_alsa_device_label; 72 | QLineEdit *gui_alsa_device_edit; 73 | 74 | QLabel *gui_file_name_label; 75 | QLineEdit *gui_file_name_edit; 76 | QPushButton *gui_file_select_button; 77 | 78 | HpiWidget *gui_asihpi_widget; 79 | 80 | QLabel *gui_jack_server_name_label; 81 | QLineEdit *gui_jack_server_name_edit; 82 | QLabel *gui_jack_client_name_label; 83 | QLineEdit *gui_jack_client_name_edit; 84 | QLabel *gui_jack_gain_label; 85 | QSpinBox *gui_jack_gain_spin; 86 | 87 | QPushButton *gui_close_button; 88 | 89 | QString gui_caption; 90 | }; 91 | 92 | 93 | #endif // SOURCEDIALOG_H 94 | -------------------------------------------------------------------------------- /src/common/spinbox.cpp: -------------------------------------------------------------------------------- 1 | // spinbox.cpp 2 | // 3 | // SpinBox widget for GlassGui 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "spinbox.h" 22 | 23 | SpinBox::SpinBox(QWidget *parent) 24 | : QSpinBox(parent) 25 | { 26 | spin_read_only=false; 27 | } 28 | 29 | 30 | bool SpinBox::isReadOnly() const 31 | { 32 | return spin_read_only; 33 | } 34 | 35 | 36 | void SpinBox::setReadOnly(bool state) 37 | { 38 | if(state!=spin_read_only) { 39 | if(state) { 40 | spin_maximum=maximum(); 41 | spin_minimum=minimum(); 42 | setRange(value(),value()); 43 | } 44 | else { 45 | setRange(spin_minimum,spin_maximum); 46 | } 47 | spin_read_only=state; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/common/spinbox.h: -------------------------------------------------------------------------------- 1 | // spinbox.h 2 | // 3 | // SpinBox widget for GlassGui 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef SPINBOX_H 22 | #define SPINBOX_H 23 | 24 | #include 25 | 26 | class SpinBox : public QSpinBox 27 | { 28 | Q_OBJECT; 29 | public: 30 | SpinBox(QWidget *parent=0); 31 | bool isReadOnly() const; 32 | void setReadOnly(bool state); 33 | 34 | private: 35 | bool spin_read_only; 36 | int spin_maximum; 37 | int spin_minimum; 38 | }; 39 | 40 | 41 | #endif // SPINBOX_H 42 | -------------------------------------------------------------------------------- /src/common/statuswidget.cpp: -------------------------------------------------------------------------------- 1 | // statuswidget.cpp 2 | // 3 | // Connection status widget 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "logging.h" 22 | #include "statuswidget.h" 23 | 24 | StatusWidget::StatusWidget(QWidget *parent) 25 | : QLabel(parent) 26 | { 27 | setAlignment(Qt::AlignCenter); 28 | 29 | // 30 | // Create Stylesheets 31 | // 32 | stat_idle_style=""; 33 | stat_connected_style="background-color: green;color: lightGray"; 34 | stat_connecting_style="background-color: #BBBB00;color: black"; 35 | stat_disconnecting_style="background-color: #BBBB00;color: black"; 36 | stat_failed_style="background-color: red;color: lightGray"; 37 | 38 | setStatus(CONNECTION_IDLE); 39 | } 40 | 41 | 42 | int StatusWidget::status() const 43 | { 44 | return stat_status; 45 | } 46 | 47 | 48 | bool StatusWidget::setStatus(int status) 49 | { 50 | bool ret=false; 51 | 52 | switch(status) { 53 | case CONNECTION_IDLE: 54 | setText(tr("IDLE")); 55 | setStyleSheet(stat_idle_style); 56 | ret=true; 57 | break; 58 | 59 | case CONNECTION_PENDING: 60 | setText(tr("CONNECTING...")); 61 | setStyleSheet(stat_connecting_style); 62 | ret=true; 63 | break; 64 | 65 | case CONNECTION_STOPPING: 66 | setText(tr("STOPPING...")); 67 | setStyleSheet(stat_connecting_style); 68 | ret=true; 69 | break; 70 | 71 | case CONNECTION_OK: 72 | setText(tr("CONNECTED")); 73 | setStyleSheet(stat_connected_style); 74 | ret=true; 75 | break; 76 | 77 | case CONNECTION_FAILED: 78 | setText(tr("RECONNECTING...")); 79 | setStyleSheet(stat_failed_style); 80 | ret=true; 81 | break; 82 | } 83 | stat_status=status; 84 | 85 | return ret; 86 | } 87 | -------------------------------------------------------------------------------- /src/common/statuswidget.h: -------------------------------------------------------------------------------- 1 | // statuswidget.h 2 | // 3 | // Connection status widget 4 | // 5 | // (C) Copyright 2015-2020 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef STATUSWIDGET_H 22 | #define STATUSWIDGET_H 23 | 24 | #include 25 | #include 26 | 27 | class StatusWidget : public QLabel 28 | { 29 | Q_OBJECT; 30 | public: 31 | StatusWidget(QWidget *parent=0); 32 | int status() const; 33 | bool setStatus(int status); 34 | 35 | private: 36 | int stat_status; 37 | QString stat_idle_style; 38 | QString stat_connecting_style; 39 | QString stat_connected_style; 40 | QString stat_disconnecting_style; 41 | QString stat_failed_style; 42 | }; 43 | 44 | 45 | #endif // STATUSWIDGET_H 46 | -------------------------------------------------------------------------------- /src/common/stereometer.h: -------------------------------------------------------------------------------- 1 | // stereometer.h 2 | // 3 | // A Stereo Audio Meter Widget 4 | // 5 | // (C) Copyright 2002-2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU Library General Public License 9 | // version 2 as published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | // 21 | 22 | #ifndef STEREOMETER_H 23 | #define STEREOMETER_H 24 | 25 | #include 26 | 27 | #include "segmeter.h" 28 | 29 | #define CLIP_LIGHT_COLOR Qt::red 30 | 31 | class StereoMeter : public QWidget 32 | { 33 | Q_OBJECT 34 | public: 35 | StereoMeter(QWidget *parent=0); 36 | QSize sizeHint() const; 37 | QSizePolicy sizePolicy() const; 38 | void setReference(int level); 39 | void setClipLight(int level); 40 | void setDarkLowColor(QColor color); 41 | void setDarkHighColor(QColor color); 42 | void setDarkClipColor(QColor color); 43 | void setLowColor(QColor color); 44 | void setHighColor(QColor color); 45 | void setClipColor(QColor color); 46 | void setHighThreshold(int level); 47 | void setClipThreshold(int level); 48 | void setSegmentSize(int size); 49 | void setSegmentGap(int gap); 50 | void setLabel(QString label); 51 | SegMeter::Mode mode() const; 52 | void setMode(SegMeter::Mode mode); 53 | 54 | public slots: 55 | void setLeftSolidBar(int level); 56 | void setRightSolidBar(int level); 57 | void setLeftFloatingBar(int level); 58 | void setRightFloatingBar(int level); 59 | void setLeftPeakBar(int level); 60 | void setRightPeakBar(int level); 61 | void resetClipLight(); 62 | 63 | signals: 64 | void clip(); 65 | 66 | protected: 67 | void paintEvent(QPaintEvent *); 68 | 69 | private: 70 | SegMeter *left_meter,*right_meter; 71 | int ref_level; 72 | int clip_light_level; 73 | bool clip_light_on; 74 | int label_x; 75 | QString meter_label; 76 | QFont meter_label_font; 77 | QFont meter_scale_font; 78 | }; 79 | 80 | 81 | #endif // STEREOMETER_H 82 | -------------------------------------------------------------------------------- /src/common/streamdialog.h: -------------------------------------------------------------------------------- 1 | // streamdialog.h 2 | // 3 | // Configuration dialog for stream metadata settings 4 | // 5 | // (C) Copyright 2015-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef STREAMDIALOG_H 22 | #define STREAMDIALOG_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "connector.h" 34 | #include "profile.h" 35 | #include "spinbox.h" 36 | 37 | class StreamDialog : public QDialog 38 | { 39 | Q_OBJECT; 40 | public: 41 | StreamDialog(const QString &caption,QWidget *parent); 42 | QSize sizeHint() const; 43 | void makeArgs(QStringList *args,bool escape_args); 44 | void setServerType(Connector::ServerType type); 45 | void setControlsLocked(bool state); 46 | void load(Profile *p); 47 | void save(FILE *f); 48 | 49 | protected: 50 | void resizeEvent(QResizeEvent *e); 51 | 52 | private: 53 | QLabel *gui_stream_label; 54 | QLabel *gui_stream_name_label; 55 | QLineEdit *gui_stream_name_edit; 56 | QLabel *gui_stream_description_label; 57 | QLineEdit *gui_stream_description_edit; 58 | QLabel *gui_stream_url_label; 59 | QLineEdit *gui_stream_url_edit; 60 | QLabel *gui_stream_genre_label; 61 | QLineEdit *gui_stream_genre_edit; 62 | QLabel *gui_stream_icq_label; 63 | QLineEdit *gui_stream_icq_edit; 64 | QLabel *gui_stream_aim_label; 65 | QLineEdit *gui_stream_aim_edit; 66 | QLabel *gui_stream_irc_label; 67 | QLineEdit *gui_stream_irc_edit; 68 | QPushButton *gui_close_button; 69 | QLabel *gui_stream_timestamp_offset_label; 70 | SpinBox *gui_stream_timestamp_offset_spin; 71 | QLabel *gui_stream_timestamp_offset_unit; 72 | QString gui_caption; 73 | }; 74 | 75 | 76 | #endif // STREAMDIALOG_H 77 | -------------------------------------------------------------------------------- /src/glasscoder/alsadevice.h: -------------------------------------------------------------------------------- 1 | // alsadevice.h 2 | // 3 | // Audio source for the Advance Linux Sound Architecture 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef ALSADEVICE_H 22 | #define ALSADEVICE_H 23 | 24 | #ifdef ALSA 25 | #include 26 | #include 27 | #endif // ALSA 28 | 29 | #include 30 | 31 | #include "audiodevice.h" 32 | #include "meteraverage.h" 33 | 34 | #define ALSA_DEFAULT_DEVICE "hw:0" 35 | #define ALSA_PERIOD_QUANTITY 4 36 | class AlsaDevice : public AudioDevice 37 | { 38 | Q_OBJECT; 39 | public: 40 | AlsaDevice(unsigned chans,unsigned samprate, 41 | Ringbuffer *ring,QObject *parent=0); 42 | ~AlsaDevice(); 43 | bool processOptions(QString *err,const QStringList &keys, 44 | const QStringList &values); 45 | bool start(QString *err); 46 | unsigned deviceSamplerate() const; 47 | 48 | private slots: 49 | void meterData(); 50 | 51 | private: 52 | #ifdef ALSA 53 | QString alsa_device; 54 | snd_pcm_t *alsa_pcm; 55 | AudioDevice::Format alsa_format; 56 | unsigned alsa_samplerate; 57 | unsigned alsa_channels; 58 | unsigned alsa_period_quantity; 59 | snd_pcm_uframes_t alsa_buffer_size; 60 | float *alsa_pcm_buffer; 61 | pthread_t alsa_pthread; 62 | MeterAverage *alsa_meter_avg[MAX_AUDIO_CHANNELS]; 63 | QTimer *alsa_meter_timer; 64 | friend void *AlsaCallback(void *ptr); 65 | #endif // ALSA 66 | }; 67 | 68 | 69 | #endif // ALSADEVICE_H 70 | -------------------------------------------------------------------------------- /src/glasscoder/asihpidevice.h: -------------------------------------------------------------------------------- 1 | // asihpidevice.h 2 | // 3 | // Audio source for AudioScience HPI devices 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef ASIHPIDEVICE_H 22 | #define ASIHPIDEVICE_H 23 | 24 | #include 25 | #include 26 | 27 | #ifdef ASIHPI 28 | #include 29 | #endif // ASIHPI 30 | 31 | #include 32 | 33 | #include "audiodevice.h" 34 | 35 | #define ASIHPI_DEFAULT_INDEX 0 36 | #define ASIHPI_DEFAULT_INPUT_INDEX 0 37 | #define ASIHPI_READ_INTERVAL 10 38 | 39 | class AsiHpiDevice : public AudioDevice 40 | { 41 | Q_OBJECT; 42 | public: 43 | AsiHpiDevice(unsigned chans,unsigned samprate, 44 | Ringbuffer *ring,QObject *parent=0); 45 | ~AsiHpiDevice(); 46 | bool isAvailable() const; 47 | bool processOptions(QString *err,const QStringList &keys, 48 | const QStringList &values); 49 | bool start(QString *err); 50 | 51 | private slots: 52 | void readData(); 53 | void meterData(); 54 | 55 | private: 56 | #ifdef ASIHPI 57 | void MakeFormat(struct hpi_format *fmt,uint16_t hfmt); 58 | hpi_err_t HpiLog(hpi_err_t err,int priority=LOG_DEBUG) const; 59 | const char *hpi_strerror(hpi_err_t err) const; 60 | 61 | // 62 | // Arguments 63 | // 64 | uint16_t asihpi_adapter_index; 65 | uint16_t asihpi_input_index; 66 | uint16_t asihpi_input_mode; 67 | uint16_t asihpi_input_gain; 68 | uint16_t asihpi_channel_mode; 69 | uint16_t asihpi_input_source; 70 | uint16_t asihpi_input_type; 71 | hpi_handle_t asihpi_input_stream; 72 | hpi_handle_t asihpi_mixer; 73 | hpi_handle_t asihpi_input_meter; 74 | uint8_t *asihpi_pcm_buffer; 75 | QTimer *asihpi_read_timer; 76 | QTimer *asihpi_meter_timer; 77 | uint32_t asihpi_dma_buffer_size; 78 | #endif // ASIHPI 79 | }; 80 | 81 | 82 | #endif // ASIHPIDEVICE_H 83 | -------------------------------------------------------------------------------- /src/glasscoder/audiodevicefactory.cpp: -------------------------------------------------------------------------------- 1 | // audiodevicefactory.cpp 2 | // 3 | // Instantiate AudioDevice classes 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "alsadevice.h" 22 | #include "asihpidevice.h" 23 | #include "filedevice.h" 24 | #include "jackdevice.h" 25 | #include "audiodevicefactory.h" 26 | AudioDevice *AudioDeviceFactory(AudioDevice::DeviceType type, 27 | unsigned chans,unsigned samprate, 28 | Ringbuffer *ring, 29 | QObject *parent) 30 | { 31 | AudioDevice *dev=NULL; 32 | 33 | switch(type) { 34 | case AudioDevice::Alsa: 35 | #ifdef ALSA 36 | dev=new AlsaDevice(chans,samprate,ring,parent); 37 | #endif // ALSA 38 | break; 39 | 40 | case AudioDevice::AsiHpi: 41 | #ifdef ASIHPI 42 | dev=new AsiHpiDevice(chans,samprate,ring,parent); 43 | #endif // ASIHPI 44 | break; 45 | 46 | case AudioDevice::File: 47 | #ifdef SNDFILE 48 | dev=new FileDevice(chans,samprate,ring,parent); 49 | #endif // SNDFILE 50 | break; 51 | 52 | case AudioDevice::Jack: 53 | #ifdef JACK 54 | dev=new JackDevice(chans,samprate,ring,parent); 55 | #endif // JACK 56 | break; 57 | 58 | case AudioDevice::LastType: 59 | break; 60 | } 61 | 62 | if(dev!=NULL) { 63 | if(!dev->isAvailable()) { 64 | delete dev; 65 | dev=NULL; 66 | } 67 | } 68 | 69 | return dev; 70 | } 71 | -------------------------------------------------------------------------------- /src/glasscoder/audiodevicefactory.h: -------------------------------------------------------------------------------- 1 | // audiodevicefactory.h 2 | // 3 | // Instantiate AudioDevice classes 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef AUDIODEVICEFACTORY_H 22 | #define AUDIODEVICEFACTORY_H 23 | 24 | #include "audiodevice.h" 25 | 26 | AudioDevice *AudioDeviceFactory(AudioDevice::DeviceType type, 27 | unsigned chans,unsigned samprate, 28 | Ringbuffer *ring,QObject *parent=0); 29 | 30 | 31 | #endif // AUDIODEVICEFACTORY_H 32 | -------------------------------------------------------------------------------- /src/glasscoder/codecfactory.cpp: -------------------------------------------------------------------------------- 1 | // codecfactory.cpp 2 | // 3 | // Instantiate Codec classes 4 | // 5 | // (C) Copyright 2014-2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "codecfactory.h" 22 | #include "fdkcodec.h" 23 | #include "mpegl2codec.h" 24 | #include "mpegl3codec.h" 25 | #include "opuscodec.h" 26 | #include "pcm16codec.h" 27 | #include "vorbiscodec.h" 28 | 29 | Codec *CodecFactory(Codec::Type type,Ringbuffer *ring,QObject *parent) 30 | { 31 | Codec *cdc=NULL; 32 | 33 | switch(type) { 34 | case Codec::TypeFdk: 35 | cdc=new FdkCodec(ring,parent); 36 | break; 37 | 38 | case Codec::TypeMpegL2: 39 | cdc=new MpegL2Codec(ring,parent); 40 | break; 41 | 42 | case Codec::TypeMpegL3: 43 | cdc=new MpegL3Codec(ring,parent); 44 | break; 45 | 46 | case Codec::TypeOpus: 47 | cdc=new OpusCodec(ring,parent); 48 | break; 49 | 50 | case Codec::TypePcm16: 51 | cdc=new Pcm16Codec(ring,parent); 52 | break; 53 | 54 | case Codec::TypeVorbis: 55 | cdc=new VorbisCodec(ring,parent); 56 | break; 57 | 58 | case Codec::TypeLast: 59 | break; 60 | } 61 | 62 | return cdc; 63 | } 64 | -------------------------------------------------------------------------------- /src/glasscoder/codecfactory.h: -------------------------------------------------------------------------------- 1 | // codecfactory.h 2 | // 3 | // Instantiate Codec classes 4 | // 5 | // (C) Copyright 2014-2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef CODECFACTORY_H 22 | #define CODECFACTORY_H 23 | 24 | #include "codec.h" 25 | 26 | Codec *CodecFactory(Codec::Type type,Ringbuffer *ring,QObject *parent=0); 27 | 28 | 29 | #endif // CODECFACTORY_H 30 | -------------------------------------------------------------------------------- /src/glasscoder/connectorfactory.cpp: -------------------------------------------------------------------------------- 1 | // connectorfactory.cpp 2 | // 3 | // Instantiate Connector classes. 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "filearchiveconnector.h" 22 | #include "fileconnector.h" 23 | #include "hlsconnector.h" 24 | #include "iceconnector.h" 25 | #include "iceoutconnector.h" 26 | #include "icestreamconnector.h" 27 | #include "icyconnector.h" 28 | #include "connectorfactory.h" 29 | 30 | Connector *ConnectorFactory(Connector::ServerType type,Config *conf, 31 | QObject *parent) 32 | { 33 | Connector *conn=NULL; 34 | 35 | switch(type) { 36 | case Connector::HlsServer: 37 | conn=new HlsConnector(conf,parent); 38 | break; 39 | 40 | case Connector::Shoutcast1Server: 41 | conn=new IcyConnector(1,parent); 42 | break; 43 | 44 | case Connector::Shoutcast2Server: 45 | conn=new IcyConnector(2,parent); 46 | break; 47 | 48 | case Connector::Icecast2Server: 49 | conn=new IceConnector(parent); 50 | break; 51 | 52 | case Connector::IcecastOutServer: 53 | conn=new IceOutConnector(parent); 54 | break; 55 | 56 | case Connector::IcecastStreamerServer: 57 | conn=new IceStreamConnector(parent); 58 | break; 59 | 60 | case Connector::FileServer: 61 | conn=new FileConnector(parent); 62 | break; 63 | 64 | case Connector::FileArchiveServer: 65 | conn=new FileArchiveConnector(parent); 66 | break; 67 | 68 | case Connector::LastServer: 69 | break; 70 | } 71 | 72 | return conn; 73 | } 74 | -------------------------------------------------------------------------------- /src/glasscoder/connectorfactory.h: -------------------------------------------------------------------------------- 1 | // connectorfactory.h 2 | // 3 | // Instantiate Connector classes 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef CONNECTORFACTORY_H 22 | #define CONNECTORFACTORY_H 23 | 24 | #include "config.h" 25 | #include "connector.h" 26 | 27 | Connector *ConnectorFactory(Connector::ServerType type,Config *conf, 28 | QObject *parent=0); 29 | 30 | 31 | #endif // CONNECTORFACTORY_H 32 | -------------------------------------------------------------------------------- /src/glasscoder/fdkcodec.h: -------------------------------------------------------------------------------- 1 | // fdkcodec.h 2 | // 3 | // Codec class for MPEG-4 Advanced Audio Coding High Efficiency Profile v2 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef FDKCODEC_H 22 | #define FDKCODEC_H 23 | 24 | #ifdef HAVE_FDKAAC 25 | #include 26 | #endif // HAVE_FDKAAC 27 | 28 | #include "codec.h" 29 | 30 | class FdkCodec : public Codec 31 | { 32 | Q_OBJECT; 33 | public: 34 | FdkCodec(Ringbuffer *ring,QObject *parent=0); 35 | ~FdkCodec(); 36 | bool isAvailable() const; 37 | QString contentType() const; 38 | unsigned pcmFrames() const; 39 | QString defaultExtension() const; 40 | QString formatIdentifier() const; 41 | bool startCodec(); 42 | 43 | protected: 44 | void encodeData(Connector *conn,const float *pcm,int frames); 45 | 46 | private: 47 | #ifdef HAVE_FDKAAC 48 | void *fdk_handle; 49 | HANDLE_AACENCODER fdk_encoder; 50 | AACENC_ERROR (*aacEncOpen)(HANDLE_AACENCODER *,const UINT,const UINT); 51 | AACENC_ERROR (*aacEncClose)(HANDLE_AACENCODER *); 52 | UINT (*aacEncoder_GetParam)(const HANDLE_AACENCODER,const AACENC_PARAM); 53 | AACENC_ERROR (*aacEncoder_SetParam)(const HANDLE_AACENCODER, 54 | const AACENC_PARAM,const UINT); 55 | AACENC_ERROR (*aacEncEncode)(const HANDLE_AACENCODER, 56 | const AACENC_BufDesc *,const AACENC_BufDesc *, 57 | const AACENC_InArgs *,AACENC_OutArgs *); 58 | AACENC_ERROR (*aacEncInfo)(const HANDLE_AACENCODER,AACENC_InfoStruct *); 59 | AACENC_ERROR (*aacEncGetLibInfo)(LIB_INFO *); 60 | unsigned long fdk_input_samples; 61 | AACENC_BufDesc fdk_input_desc; 62 | INT_PCM *fdk_input_buffer; 63 | INT fdk_input_ids[1]; 64 | INT fdk_input_sizes[1]; 65 | INT fdk_inputel_sizes[1]; 66 | AACENC_BufDesc fdk_output_desc; 67 | UCHAR *fdk_output_buffer; 68 | INT fdk_output_ids[1]; 69 | INT fdk_output_sizes[1]; 70 | INT fdk_outputel_sizes[1]; 71 | AACENC_InfoStruct fdk_info; 72 | #endif // HAVE_FDKAAC 73 | }; 74 | 75 | 76 | #endif // FDKCODEC_H 77 | -------------------------------------------------------------------------------- /src/glasscoder/filearchiveconnector.h: -------------------------------------------------------------------------------- 1 | // filearchiveconnector.h 2 | // 3 | // Source connector class for local file archives 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef FILEARCHIVECONNECTOR_H 22 | #define FILEARCHIVECONNECTOR_H 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #include "connector.h" 30 | 31 | #define FILEARCHIVE_DATETIME_PATTERN "yyyy-MM-dd-hh" 32 | 33 | class FileArchiveConnector : public Connector 34 | { 35 | Q_OBJECT; 36 | public: 37 | FileArchiveConnector(QObject *parent=0); 38 | ~FileArchiveConnector(); 39 | FileArchiveConnector::ServerType serverType() const; 40 | 41 | private slots: 42 | void rotateFile(); 43 | 44 | protected: 45 | void connectToHostConnector(const QUrl &url); 46 | void disconnectFromHostConnector(); 47 | int64_t writeDataConnector(int frames,const unsigned char *data,int64_t len); 48 | 49 | private: 50 | bool DidHourAdvance(const QDateTime &dt); 51 | QString GetFilename(const QDateTime &dt) const; 52 | QTimer *archive_rotate_timer; 53 | int archive_fd; 54 | SNDFILE *archive_snd; 55 | SF_INFO archive_sf; 56 | int archive_hour; 57 | }; 58 | 59 | 60 | #endif // FILEARCHIVECONNECTOR_H 61 | -------------------------------------------------------------------------------- /src/glasscoder/fileconnector.cpp: -------------------------------------------------------------------------------- 1 | // fileconnector.cpp 2 | // 3 | // Source connector class for local files 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | #include "fileconnector.h" 31 | #include "logging.h" 32 | 33 | FileConnector::FileConnector(QObject *parent) 34 | : Connector(parent) 35 | { 36 | file_fd=-1; 37 | file_snd=NULL; 38 | } 39 | 40 | 41 | FileConnector::~FileConnector() 42 | { 43 | if(file_snd!=NULL) { 44 | sf_close(file_snd); 45 | } 46 | if(file_fd>=0) { 47 | close(file_fd); 48 | } 49 | } 50 | 51 | 52 | FileConnector::ServerType FileConnector::serverType() const 53 | { 54 | return Connector::FileServer; 55 | } 56 | 57 | 58 | void FileConnector::connectToHostConnector(const QUrl &url) 59 | { 60 | SF_INFO sf; 61 | if(contentType()=="audio/x-wav") { 62 | memset(&sf,0,sizeof(sf)); 63 | sf.samplerate=audioSamplerate(); 64 | sf.channels=audioChannels(); 65 | sf.format=SF_FORMAT_WAV|SF_FORMAT_PCM_16; 66 | if((file_snd=sf_open(serverMountpoint().toUtf8(),SFM_WRITE,&sf))!=NULL) { 67 | setConnected(true); 68 | } 69 | else { 70 | Log(LOG_ERR,("unable to open destination file \""+serverMountpoint()+ 71 | "\" ["+sf_strerror(file_snd)+"]").toUtf8()); 72 | setConnected(false); 73 | } 74 | } 75 | else { 76 | if((file_fd=open(serverMountpoint().toUtf8(),O_WRONLY|O_TRUNC|O_CREAT, 77 | S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))>=0) { 78 | setConnected(true); 79 | } 80 | else { 81 | Log(LOG_ERR,("unable to open destination file \""+serverMountpoint()+ 82 | "\" ["+strerror(errno)+"]").toUtf8()); 83 | setConnected(false); 84 | } 85 | } 86 | emit unmuteRequested(); 87 | } 88 | 89 | 90 | void FileConnector::disconnectFromHostConnector() 91 | { 92 | if(file_snd==NULL) { 93 | close(file_fd); 94 | file_fd=-1; 95 | } 96 | else { 97 | sf_close(file_snd); 98 | file_snd=NULL; 99 | } 100 | } 101 | 102 | 103 | int64_t FileConnector::writeDataConnector(int frames,const unsigned char *data, 104 | int64_t len) 105 | { 106 | if(file_snd==NULL) { 107 | return write(file_fd,data,len); 108 | } 109 | short pcm[frames*audioChannels()]; 110 | for(int i=0;i 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef FILECONNECTOR_H 22 | #define FILECONNECTOR_H 23 | 24 | #include 25 | 26 | #include "connector.h" 27 | 28 | class FileConnector : public Connector 29 | { 30 | Q_OBJECT; 31 | public: 32 | FileConnector(QObject *parent=0); 33 | ~FileConnector(); 34 | FileConnector::ServerType serverType() const; 35 | 36 | protected: 37 | void connectToHostConnector(const QUrl &url); 38 | void disconnectFromHostConnector(); 39 | int64_t writeDataConnector(int frames,const unsigned char *data,int64_t len); 40 | 41 | private: 42 | int file_fd; 43 | SNDFILE *file_snd; 44 | }; 45 | 46 | 47 | #endif // FILECONNECTOR_H 48 | -------------------------------------------------------------------------------- /src/glasscoder/filedevice.h: -------------------------------------------------------------------------------- 1 | // filedevice.h 2 | // 3 | // Audio source for streaming direct from a file. 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef FILEDEVICE_H 22 | #define FILEDEVICE_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #ifdef SNDFILE 32 | #include 33 | #endif // SNDFILE 34 | 35 | #include "audiodevice.h" 36 | #include "meteraverage.h" 37 | #include "ringbuffer.h" 38 | 39 | #define SNDFILE_BUFFER_SIZE 1024 40 | 41 | class FileDevice : public AudioDevice 42 | { 43 | Q_OBJECT; 44 | public: 45 | FileDevice(unsigned chans,unsigned samprate, 46 | Ringbuffer *ring,QObject *parent=0); 47 | ~FileDevice(); 48 | bool processOptions(QString *err,const QStringList &keys, 49 | const QStringList &values); 50 | bool start(QString *err); 51 | unsigned deviceSamplerate() const; 52 | 53 | public slots: 54 | void unmute(); 55 | 56 | private slots: 57 | void readTimerData(); 58 | 59 | private: 60 | #ifdef SNDFILE 61 | QString file_name; 62 | SNDFILE *file_sndfile; 63 | SF_INFO file_sfinfo; 64 | QTimer *file_read_timer; 65 | MeterAverage *file_meter_avg[MAX_AUDIO_CHANNELS]; 66 | bool file_muted; 67 | #endif // SNDFILE 68 | }; 69 | 70 | 71 | #endif // FILEDEVICE_H 72 | -------------------------------------------------------------------------------- /src/glasscoder/getconveyor.h: -------------------------------------------------------------------------------- 1 | // getconveyor.h 2 | // 3 | // Serialized service for processing http GET transactions 4 | // 5 | // (C) Copyright 2015-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef GETCONVEYOR_H 22 | #define GETCONVEYOR_H 23 | 24 | #include 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | class GetConveyor : public QObject 37 | { 38 | Q_OBJECT; 39 | public: 40 | GetConveyor(QObject *parent=0); 41 | ~GetConveyor(); 42 | void setUsername(const QString &str); 43 | void setPassword(const QString &str); 44 | void setUserAgent(const QString &str); 45 | void setAddedHeaders(const QStringList &hdrs); 46 | void push(const QUrl &url); 47 | 48 | signals: 49 | void eventFinished(const QUrl &url,int exit_code,int resp_code, 50 | const QStringList &args); 51 | void error(const QUrl &url,QProcess::ProcessError err, 52 | const QStringList &args); 53 | 54 | private slots: 55 | void processErrorData(QProcess::ProcessError err); 56 | void processFinishedData(int exit_code,QProcess::ExitStatus exit_status); 57 | void processCollectGarbageData(); 58 | 59 | private: 60 | void Dispatch(); 61 | void AddHeaders(QStringList *arglist,const QStringList &hdrs); 62 | void AddCurlAuthArgs(QStringList *arglist,const QUrl &url); 63 | std::queue conv_events; 64 | QProcess *conv_process; 65 | QStringList conv_arguments; 66 | QTimer *conv_garbage_timer; 67 | QString conv_username; 68 | QString conv_password; 69 | QString conv_user_agent; 70 | QStringList conv_added_headers; 71 | }; 72 | 73 | 74 | #endif // GETCONVEYOR_H 75 | -------------------------------------------------------------------------------- /src/glasscoder/glasscoder.h: -------------------------------------------------------------------------------- 1 | // glasscoder.h 2 | // 3 | // glasscoder(1) Audio Encoder 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef GLASSCODER_H 22 | #define GLASSCODER_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "audiodevice.h" 33 | #include "codec.h" 34 | #include "config.h" 35 | #include "connector.h" 36 | #include "glasslimits.h" 37 | #include "metaserver.h" 38 | #include "ringbuffer.h" 39 | 40 | class MainObject : public QObject 41 | { 42 | Q_OBJECT; 43 | public: 44 | MainObject(QObject *parent=0); 45 | 46 | private slots: 47 | void stdinActivatedData(int sock); 48 | void audioDeviceStoppedData(); 49 | void connectorStoppedData(); 50 | void meterData(); 51 | void connectedData(bool state); 52 | void exitTimerData(); 53 | 54 | private: 55 | Config *sir_config; 56 | // 57 | // Audio Device 58 | // 59 | bool StartAudioDevice(); 60 | Ringbuffer *sir_ringbuffer; 61 | AudioDevice *sir_audio_device; 62 | 63 | // 64 | // Server Connection 65 | // 66 | void StartServerConnection(const QString &mntpt=""); 67 | std::vector sir_connectors; 68 | 69 | // 70 | // Codec 71 | // 72 | bool StartCodec(); 73 | Codec * sir_codec; 74 | 75 | // 76 | // Metadata Processor 77 | // 78 | MetaServer *sir_meta_server; 79 | 80 | // 81 | // Miscelaneous 82 | // 83 | bool StartSingleStream(); 84 | QTimer *sir_meter_timer; 85 | QTimer *sir_exit_timer; 86 | unsigned sir_exit_count; 87 | 88 | // 89 | // Stdin Processor 90 | // 91 | void ProcessCommand(const QString &cmd); 92 | QSocketNotifier *sir_stdin_notify; 93 | QString sir_stdin_accum; 94 | }; 95 | 96 | 97 | #endif // GLASSCODER_H 98 | -------------------------------------------------------------------------------- /src/glasscoder/glassconv.h: -------------------------------------------------------------------------------- 1 | // glassconv.h 2 | // 3 | // glassconv(1) File Conveyor Service 4 | // 5 | // (C) Copyright 2022-2025 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef GLASSCONV_H 22 | #define GLASSCONV_H 23 | 24 | #include 25 | 26 | #include 27 | 28 | #ifdef HAVE_AWS_S3 29 | #include 30 | #include 31 | #endif // HAVE_AWS_S3 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "config.h" 39 | 40 | #define GLASSCONV_USAGE "--source-dir= --dest-url= [--debug]" 41 | 42 | class MainObject : public QObject 43 | { 44 | Q_OBJECT; 45 | public: 46 | MainObject(QObject *parent=0); 47 | 48 | private slots: 49 | void scanData(); 50 | 51 | private: 52 | void ProcessFile(const QString &filename); 53 | void Put(const QString &destname,const QString &srcname); 54 | void PutCurl(const QString &destname,const QString &srcname); 55 | void PutAwsS3(const QString &destname,const QString &srcname); 56 | void Delete(const QString &destname); 57 | void DeleteHttp(const QString &destname); 58 | void DeleteFile(const QString &destname); 59 | void DeleteSftp(const QString &destname); 60 | void DeleteAwsS3(const QString &destname) const; 61 | void SetCurlAuthentication(CURL *handle) const; 62 | void UnlinkLocalFile(const QString &pathname) const; 63 | void Log(int prio,const char *fmt,...) const; 64 | void SetS3FileMetadata(Aws::S3::Model::PutObjectRequest &request, 65 | const QString &filename) const; 66 | void CleanS3Bucket(const QUrl &bucket_prefix) const; 67 | QStringList ListS3Objects(const QString &prefix) const; 68 | void CleanExit(Config::ExitCode exit_code) const; 69 | QDir *d_source_dir; 70 | QUrl *d_dest_url; 71 | QString d_username; 72 | QString d_password; 73 | QString d_ssh_identity; 74 | QTimer *d_scan_timer; 75 | CURL *d_curl_handle; 76 | char d_curl_errorbuffer[CURL_ERROR_SIZE]; 77 | QString d_user_agent; 78 | QUrl d_preclean_url; 79 | Aws::SDKOptions d_aws_options; 80 | }; 81 | 82 | 83 | #endif // GLASSCONV_H 84 | -------------------------------------------------------------------------------- /src/glasscoder/hlsconnector.h: -------------------------------------------------------------------------------- 1 | // hlsconnector.h 2 | // 3 | // HLS/HTTP streaming connector for GlassCoder 4 | // 5 | // (C) Copyright 2014-2025 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef HLSCONNECTOR_H 22 | #define HLSCONNECTOR_H 23 | 24 | #define HLS_SEGMENT_SIZE 10 25 | #define HLS_VERSION 3 26 | #define HLS_MINIMUM_SEGMENT_QUAN 4 27 | #define HLS_ID3_HEADER_SIZE 73 28 | 29 | // 30 | // The Pantos & May draft HLS spec calls for placing an ID3 PRIV timestamp 31 | // at the start of each media segment [Section 3]. However, doing so causes 32 | // certain players -- e.g. VLC -- to produce audable glitches in the playout. 33 | // 34 | // Define this to suppress generation of such timestamps. 35 | // 36 | // #define HLS_OMIT_ID3_TIMESTAMPS 37 | 38 | #include 39 | 40 | #include 41 | 42 | #include 43 | 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #include "config.h" 52 | #include "connector.h" 53 | #include "netconveyor.h" 54 | 55 | class HlsConnector : public Connector 56 | { 57 | Q_OBJECT; 58 | public: 59 | HlsConnector(Config *conf,QObject *parent); 60 | ~HlsConnector(); 61 | Connector::ServerType serverType() const; 62 | 63 | public slots: 64 | void sendMetadata(MetaEvent *e); 65 | 66 | protected: 67 | void startStopping(); 68 | void connectToHostConnector(const QUrl &url); 69 | void disconnectFromHostConnector(); 70 | int64_t writeDataConnector(int frames,const unsigned char *data,int64_t len); 71 | void processConveyorEnvironment(QProcessEnvironment &env) const; 72 | 73 | private slots: 74 | void conveyorStoppedData(); 75 | 76 | private: 77 | void RotateMediaFile(); 78 | void WritePlaylistFile(); 79 | QString GetMediaFilename(int seqno); 80 | void GetStreamTimestamp(uint8_t *bytes,uint64_t frames); 81 | void AddTextIdFrame(TagLib::ID3v2::Tag *tag,const QString &id, 82 | const QString &value) const; 83 | void AddTXXXFrame(TagLib::ID3v2::Tag *tag,const QString &desc, 84 | const QString &value) const; 85 | QDir *hls_temp_dir; 86 | QString hls_playlist_filename; 87 | int hls_sequence_head; 88 | int hls_sequence_back; 89 | std::map hls_media_durations; 90 | std::map hls_media_datetimes; 91 | std::map hls_media_killtimes; 92 | QString hls_media_filename; 93 | FILE *hls_media_handle; 94 | uint64_t hls_media_frames; 95 | uint64_t hls_total_media_frames; 96 | QString hls_put_directory; 97 | QString hls_put_basename; 98 | QString hls_put_basestamp; 99 | NetConveyor *hls_conveyor; 100 | QDateTime hls_start_datetime; 101 | QByteArray hls_metadata_tag; 102 | bool hls_metadata_updated; 103 | Config *hls_config; 104 | }; 105 | 106 | 107 | #endif // HLSCONNECTOR_H 108 | -------------------------------------------------------------------------------- /src/glasscoder/httpuser.cpp: -------------------------------------------------------------------------------- 1 | // httpuser.cpp 2 | // 3 | // Abstract an HTTP user 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "httpuser.h" 22 | 23 | HttpUser::HttpUser(const QString &name,const QString &passwd) 24 | { 25 | user_name=name; 26 | user_password=passwd; 27 | } 28 | 29 | 30 | QString HttpUser::name() const 31 | { 32 | return user_name; 33 | } 34 | 35 | 36 | QString HttpUser::password() const 37 | { 38 | return user_password; 39 | } 40 | 41 | 42 | void HttpUser::setPassword(const QString &passwd) 43 | { 44 | user_password=passwd; 45 | } 46 | 47 | 48 | bool HttpUser::isValid(const QString &name,const QString &passwd) 49 | { 50 | return (name==user_name)&&(passwd==user_password); 51 | } 52 | -------------------------------------------------------------------------------- /src/glasscoder/httpuser.h: -------------------------------------------------------------------------------- 1 | // httpuser.h 2 | // 3 | // Abstract an HTTP user 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef HTTPUSER_H 22 | #define HTTPUSER_H 23 | 24 | #include 25 | 26 | class HttpUser 27 | { 28 | public: 29 | HttpUser(const QString &name,const QString &passwd); 30 | QString name() const; 31 | QString password() const; 32 | void setPassword(const QString &passwd); 33 | bool isValid(const QString &name,const QString &passwd); 34 | 35 | private: 36 | QString user_name; 37 | QString user_password; 38 | }; 39 | 40 | 41 | #endif // HTTPUSER_H 42 | -------------------------------------------------------------------------------- /src/glasscoder/iceconnector.h: -------------------------------------------------------------------------------- 1 | // iceconnector.h 2 | // 3 | // Source connector class for IceCast2 servers. 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef ICECONNECTOR_H 22 | #define ICECONNECTOR_H 23 | 24 | #include "connector.h" 25 | #include "getconveyor.h" 26 | 27 | class IceConnector : public Connector 28 | { 29 | Q_OBJECT; 30 | public: 31 | IceConnector(QObject *parent=0); 32 | ~IceConnector(); 33 | IceConnector::ServerType serverType() const; 34 | 35 | public slots: 36 | void sendMetadata(MetaEvent *e); 37 | 38 | protected: 39 | void connectToHostConnector(const QUrl &url); 40 | void disconnectFromHostConnector(); 41 | int64_t writeDataConnector(int frames,const unsigned char *data,int64_t len); 42 | 43 | private slots: 44 | void socketConnectedData(); 45 | void socketDisconnectedData(); 46 | void socketReadyReadData(); 47 | void socketErrorData(QAbstractSocket::SocketError err); 48 | void conveyorEventFinished(const QUrl &url,int exit_code, 49 | int resp_code,const QStringList &args); 50 | void conveyorError(const QUrl &url,QProcess::ProcessError err, 51 | const QStringList &args); 52 | 53 | private: 54 | void ProcessHeaders(const QString &hdrs); 55 | void WriteHeader(const QString &str); 56 | QTcpSocket *ice_socket; 57 | QString ice_recv_buffer; 58 | GetConveyor *ice_conveyor; 59 | }; 60 | 61 | 62 | #endif // ICECONNECTOR_H 63 | -------------------------------------------------------------------------------- /src/glasscoder/iceoutconnector.cpp: -------------------------------------------------------------------------------- 1 | // iceoutconnector.cpp 2 | // 3 | // Glasscoder connector for a single Icecast stream 4 | // 5 | // (C) Copyright 2014-2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "iceoutconnector.h" 32 | 33 | IceOutConnector::IceOutConnector(QObject *parent) 34 | : Connector(parent) 35 | { 36 | } 37 | 38 | 39 | IceOutConnector::~IceOutConnector() 40 | { 41 | } 42 | 43 | 44 | Connector::ServerType IceOutConnector::serverType() const 45 | { 46 | return Connector::IcecastOutServer; 47 | } 48 | 49 | 50 | void IceOutConnector::startStopping() 51 | { 52 | emit stopped(); 53 | } 54 | 55 | 56 | void IceOutConnector::connectToHostConnector(const QUrl &url) 57 | { 58 | StartStream(); 59 | setConnected(true); 60 | emit unmuteRequested(); 61 | } 62 | 63 | 64 | void IceOutConnector::disconnectFromHostConnector() 65 | { 66 | } 67 | 68 | 69 | int64_t IceOutConnector::writeDataConnector(int frames, 70 | const unsigned char *data, 71 | int64_t len) 72 | { 73 | fwrite(data,len,1,stdout); 74 | return len; 75 | } 76 | 77 | 78 | void IceOutConnector::SendHeader(const QString &hdr) const 79 | { 80 | printf("%s\r\n",(const char *)hdr.toUtf8()); 81 | } 82 | 83 | 84 | void IceOutConnector::StartStream() 85 | { 86 | // 87 | // Send Headers 88 | // 89 | SendHeader("Content-Type: "+contentType()); 90 | SendHeader("icy-br: "+QString().sprintf("%u",audioBitrate())); 91 | SendHeader("ice-audio-info: "+ 92 | QString().sprintf("bitrate=%u",audioBitrate())); 93 | SendHeader("icy-description: "+streamDescription()); 94 | SendHeader("icy-genre: "+streamGenre()); 95 | SendHeader("icy-name: "+streamName()); 96 | SendHeader("icy-pub: "+QString().sprintf("%u",streamPublic())); 97 | SendHeader("icy-url: "+streamUrl().toString()); 98 | SendHeader(); 99 | } 100 | -------------------------------------------------------------------------------- /src/glasscoder/iceoutconnector.h: -------------------------------------------------------------------------------- 1 | // iceoutconnector.h 2 | // 3 | // Glasscoder connector for a single IceCast stream 4 | // 5 | // (C) Copyright 2014-2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef ICEOUTCONNECTOR_H 22 | #define ICEOUTCONNECTOR_H 23 | 24 | #include "connector.h" 25 | 26 | class IceOutConnector : public Connector 27 | { 28 | Q_OBJECT; 29 | public: 30 | IceOutConnector(QObject *parent=0); 31 | ~IceOutConnector(); 32 | Connector::ServerType serverType() const; 33 | 34 | protected: 35 | void startStopping(); 36 | void connectToHostConnector(const QUrl &url); 37 | void disconnectFromHostConnector(); 38 | int64_t writeDataConnector(int frames,const unsigned char *data,int64_t len); 39 | 40 | private: 41 | void SendHeader(const QString &hdr="") const; 42 | void StartStream(); 43 | }; 44 | 45 | 46 | #endif // ICEOUTCONNECTOR_H 47 | -------------------------------------------------------------------------------- /src/glasscoder/icyconnector.h: -------------------------------------------------------------------------------- 1 | // icyconnector.h 2 | // 3 | // Source connector class for ShoutCast v1 servers. 4 | // 5 | // (C) Copyright 2014-2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef ICYCONNECTOR_H 22 | #define ICYCONNECTOR_H 23 | 24 | #include "connector.h" 25 | #include "getconveyor.h" 26 | 27 | class IcyConnector : public Connector 28 | { 29 | Q_OBJECT; 30 | public: 31 | IcyConnector(int ver,QObject *parent=0); 32 | ~IcyConnector(); 33 | IcyConnector::ServerType serverType() const; 34 | 35 | public slots: 36 | void sendMetadata(MetaEvent *e); 37 | 38 | protected: 39 | void connectToHostConnector(const QUrl &url); 40 | void disconnectFromHostConnector(); 41 | int64_t writeDataConnector(int frames,const unsigned char *data,int64_t len); 42 | 43 | private slots: 44 | void socketConnectedData(); 45 | void socketDisconnectedData(); 46 | void socketReadyReadData(); 47 | void socketErrorData(QAbstractSocket::SocketError err); 48 | void conveyorEventFinished(const QUrl &url,int exit_code, 49 | int resp_code,const QStringList &args); 50 | void conveyorError(const QUrl &url,QProcess::ProcessError err, 51 | const QStringList &args); 52 | 53 | private: 54 | void ProcessHeaders(const QString &hdrs); 55 | void WriteHeader(const QString &str); 56 | QTcpSocket *icy_socket; 57 | QString icy_recv_buffer; 58 | int icy_protocol_version; 59 | bool icy_authenticated; 60 | GetConveyor *icy_conveyor; 61 | }; 62 | 63 | 64 | #endif // ICYCONNECTOR_H 65 | -------------------------------------------------------------------------------- /src/glasscoder/jackdevice.h: -------------------------------------------------------------------------------- 1 | // jackdevice.h 2 | // 3 | // Audio source for the Jack Audio Connection Kit 4 | // 5 | // (C) Copyright 2014-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef JACKDEVICE_H 22 | #define JACKDEVICE_H 23 | 24 | #ifdef JACK 25 | #include 26 | #endif // JACK 27 | 28 | #include 29 | #include 30 | 31 | #include "audiodevice.h" 32 | #include "glasslimits.h" 33 | #include "meteraverage.h" 34 | 35 | #define DEFAULT_JACK_CLIENT_NAME "glasscoder" 36 | 37 | class JackDevice : public AudioDevice 38 | { 39 | Q_OBJECT; 40 | public: 41 | JackDevice(unsigned chans,unsigned samprate, 42 | Ringbuffer *ring,QObject *parent=0); 43 | ~JackDevice(); 44 | bool processOptions(QString *err,const QStringList &keys, 45 | const QStringList &values); 46 | bool start(QString *err); 47 | unsigned deviceSamplerate() const; 48 | 49 | private slots: 50 | void meterData(); 51 | 52 | private: 53 | #ifdef JACK 54 | QString jack_server_name; 55 | QString jack_client_name; 56 | float jack_gain; 57 | jack_client_t *jack_jack_client; 58 | jack_nframes_t jack_jack_sample_rate; 59 | jack_port_t *jack_jack_ports[MAX_AUDIO_CHANNELS]; 60 | MeterAverage *jack_meter_avg[MAX_AUDIO_CHANNELS]; 61 | QTimer *jack_meter_timer; 62 | friend int JackProcess(jack_nframes_t nframes, void *arg); 63 | #endif // JACK 64 | }; 65 | 66 | 67 | #endif // JACKDEVICE_H 68 | -------------------------------------------------------------------------------- /src/glasscoder/logsystemsyslog.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElvishArtisan/GlassCoder/e23b6aff30fb17c7a0ba6b45a47b5432f281db0e/src/glasscoder/logsystemsyslog.cpp -------------------------------------------------------------------------------- /src/glasscoder/metaserver.h: -------------------------------------------------------------------------------- 1 | // metaserver.h 2 | // 3 | // HTTP Server for Metadata Processing 4 | // 5 | // (C) Copyright 2016-2019 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef METASERVER_H 22 | #define METASERVER_H 23 | 24 | 25 | #include "config.h" 26 | #include "httpserver.h" 27 | #include "metaevent.h" 28 | 29 | class MetaServer : public HttpServer 30 | { 31 | Q_OBJECT; 32 | public: 33 | MetaServer(Config *config,QObject *parent=0); 34 | 35 | signals: 36 | void metadataReceived(MetaEvent *e); 37 | 38 | protected: 39 | void getRequestReceived(HttpConnection *conn); 40 | void postRequestReceived(HttpConnection *conn); 41 | bool authenticateUser(const QString &realm,const QString &name, 42 | const QString &passwd); 43 | 44 | private: 45 | bool ProcessJsonMetadataUpdates(const QJsonObject &obj); 46 | Config *meta_config; 47 | }; 48 | 49 | 50 | #endif // METASERVER_H 51 | -------------------------------------------------------------------------------- /src/glasscoder/meteraverage.cpp: -------------------------------------------------------------------------------- 1 | // meteraverage.cpp 2 | // 3 | // Average sucessive levels for a meter. 4 | // 5 | // (C) Copyright 2007-2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "meteraverage.h" 22 | 23 | MeterAverage::MeterAverage(int maxsize) 24 | { 25 | avg_maxsize=maxsize; 26 | avg_total=0.0; 27 | } 28 | 29 | 30 | float MeterAverage::average() const 31 | { 32 | if(avg_values.size()==0) { 33 | return 0.0; 34 | } 35 | return avg_total/((float)avg_values.size()); 36 | } 37 | 38 | 39 | void MeterAverage::addValue(float value) 40 | { 41 | avg_total+=value; 42 | avg_values.push(value); 43 | int size=avg_values.size()-avg_maxsize; 44 | for(int i=0;i 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef METERAVERAGE_H 22 | #define METERAVERAGE_H 23 | 24 | #include 25 | 26 | class MeterAverage 27 | { 28 | public: 29 | MeterAverage(int maxsize); 30 | float average() const; 31 | void addValue(float value); 32 | 33 | private: 34 | int avg_maxsize; 35 | float avg_total; 36 | std::queue avg_values; 37 | }; 38 | 39 | 40 | #endif // METERAVERAGE_H 41 | -------------------------------------------------------------------------------- /src/glasscoder/mpegl2codec.h: -------------------------------------------------------------------------------- 1 | // mpegl2codec.h 2 | // 3 | // Codec class for MPEG-1 Layer 3 4 | // 5 | // (C) Copyright 2014-2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef MPEGL2CODEC_H 22 | #define MPEGL2CODEC_H 23 | 24 | #ifdef HAVE_TWOLAME 25 | #include 26 | #endif // HAVE_TWOLAME 27 | 28 | #include "codec.h" 29 | 30 | class MpegL2Codec : public Codec 31 | { 32 | Q_OBJECT; 33 | public: 34 | MpegL2Codec(Ringbuffer *ring,QObject *parent=0); 35 | bool isAvailable() const; 36 | QString contentType() const; 37 | unsigned pcmFrames() const; 38 | QString defaultExtension() const; 39 | QString formatIdentifier() const; 40 | bool startCodec(); 41 | 42 | protected: 43 | void encodeData(Connector *conn,const float *pcm,int frames); 44 | 45 | private: 46 | #ifdef HAVE_TWOLAME 47 | void *twolame_handle; 48 | twolame_options *twolame_lameopts; 49 | twolame_options *(*twolame_init)(void); 50 | void (*twolame_set_mode)(twolame_options *,TWOLAME_MPEG_mode); 51 | void (*twolame_set_num_channels)(twolame_options *,int); 52 | void (*twolame_set_in_samplerate)(twolame_options *,int); 53 | void (*twolame_set_out_samplerate)(twolame_options *,int); 54 | void (*twolame_set_bitrate)(twolame_options *,int); 55 | int (*twolame_init_params)(twolame_options *); 56 | void (*twolame_close)(twolame_options **); 57 | int (*twolame_encode_buffer_interleaved)(twolame_options *,const short int[], 58 | int,unsigned char *,int); 59 | int (*twolame_encode_buffer_float32_interleaved) 60 | (twolame_options *,const float[],int,unsigned char *,int); 61 | int (*twolame_encode_flush)(twolame_options *,unsigned char *,int); 62 | int (*twolame_set_energy_levels)(twolame_options *,int); 63 | int (*twolame_set_VBR)(twolame_options *, int); 64 | int (*twolame_set_VBR_level)(twolame_options *, float); 65 | #endif // HAVE_TWOLAME 66 | }; 67 | 68 | 69 | #endif // MPEGL2CODEC_H 70 | -------------------------------------------------------------------------------- /src/glasscoder/netconveyor.h: -------------------------------------------------------------------------------- 1 | // netconveyor.h 2 | // 3 | // Serialized service for uploading files 4 | // 5 | // (C) Copyright 2015-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef NETCONVEYOR_H 22 | #define NETCONVEYOR_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "config.h" 32 | 33 | class NetConveyorEvent 34 | { 35 | public: 36 | // enum HttpMethod {NoMethod=0,GetMethod=1,PutMethod=2,DeleteMethod=3, 37 | // PostMethod=4,HeadMethod=5,StopMethod=6}; 38 | enum HttpMethod {PutMethod=0,DeleteMethod=1,StopMethod=2}; 39 | NetConveyorEvent(void *orig,const QString &pathname,HttpMethod meth); 40 | void *originator() const; 41 | QString pathname() const; 42 | NetConveyorEvent::HttpMethod method() const; 43 | QString dump() const; 44 | static QString httpMethodString(HttpMethod method); 45 | 46 | private: 47 | void *evt_originator; 48 | QString evt_pathname; 49 | NetConveyorEvent::HttpMethod evt_method; 50 | }; 51 | 52 | 53 | class NetConveyor : public QObject 54 | { 55 | Q_OBJECT; 56 | public: 57 | NetConveyor(Config *conf,QObject *parent=0); 58 | ~NetConveyor(); 59 | void push(void *orig,const QString &pathname, 60 | NetConveyorEvent::HttpMethod meth); 61 | void push(const NetConveyorEvent &evt); 62 | void stop(); 63 | 64 | signals: 65 | void stopped(); 66 | 67 | private slots: 68 | void startConveyorProcess(); 69 | void processFinishedData(int exit_code,QProcess::ExitStatus exit_status); 70 | void processReadyReadData(); 71 | 72 | private: 73 | QProcess *conv_process; 74 | QTimer *conv_restart_timer; 75 | QDir *conv_temp_dir; 76 | QStringList conv_putted_files; 77 | Config *conv_config; 78 | }; 79 | 80 | 81 | #endif // NETCONVEYOR_H 82 | -------------------------------------------------------------------------------- /src/glasscoder/pcm16codec.cpp: -------------------------------------------------------------------------------- 1 | // pcm16codec.cpp 2 | // 3 | // Codec class for 16 bit PCM (little endian) 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | 23 | #include 24 | 25 | #include "pcm16codec.h" 26 | 27 | Pcm16Codec::Pcm16Codec(Ringbuffer *ring,QObject *parent) 28 | : Codec(Codec::TypePcm16,ring,parent) 29 | { 30 | } 31 | 32 | 33 | bool Pcm16Codec::isAvailable() const 34 | { 35 | return true; 36 | } 37 | 38 | 39 | QString Pcm16Codec::contentType() const 40 | { 41 | return QString("audio/x-wav"); 42 | } 43 | 44 | 45 | unsigned Pcm16Codec::pcmFrames() const 46 | { 47 | return 1024; 48 | } 49 | 50 | 51 | QString Pcm16Codec::defaultExtension() const 52 | { 53 | return QString("wav"); 54 | } 55 | 56 | 57 | QString Pcm16Codec::formatIdentifier() const 58 | { 59 | return QString("wav"); 60 | } 61 | 62 | 63 | bool Pcm16Codec::startCodec() 64 | { 65 | return true; 66 | } 67 | 68 | 69 | void Pcm16Codec::encodeData(Connector *conn,const float *pcm,int frames) 70 | { 71 | src_float_to_short_array(pcm,pcm16_buffer,frames*channels()); 72 | for(int i=0;i<(frames*(int)channels());i++) { 73 | pcm16_buffer[i]=htons(pcm16_buffer[i]); 74 | } 75 | conn->writeData(frames,(const unsigned char *)pcm16_buffer, 76 | frames*channels()*2); 77 | } 78 | -------------------------------------------------------------------------------- /src/glasscoder/pcm16codec.h: -------------------------------------------------------------------------------- 1 | // pcm16codec.h 2 | // 3 | // Codec class for 16 bit PCM (little endian) 4 | // 5 | // (C) Copyright 2015 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef PCM16CODEC_H 22 | #define PCM16CODEC_H 23 | 24 | #include "codec.h" 25 | 26 | #define PCM16_MAX_FRAMES 1024 27 | 28 | class Pcm16Codec : public Codec 29 | { 30 | Q_OBJECT; 31 | public: 32 | Pcm16Codec(Ringbuffer *ring,QObject *parent=0); 33 | bool isAvailable() const; 34 | QString contentType() const; 35 | unsigned pcmFrames() const; 36 | QString defaultExtension() const; 37 | QString formatIdentifier() const; 38 | bool startCodec(); 39 | 40 | protected: 41 | void encodeData(Connector *conn,const float *pcm,int frames); 42 | 43 | private: 44 | short pcm16_buffer[PCM16_MAX_FRAMES*MAX_AUDIO_CHANNELS]; 45 | }; 46 | 47 | 48 | #endif // PCM16CODEC_H 49 | -------------------------------------------------------------------------------- /src/glasscoder/socketmessage.cpp: -------------------------------------------------------------------------------- 1 | // socketmessage.cpp 2 | // 3 | // Abstract a WebSockets message 4 | // 5 | // (C) Copyright 2016-2019 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "socketmessage.h" 22 | 23 | SocketMessage::SocketMessage() 24 | { 25 | sock_op_code=SocketMessage::Close; 26 | } 27 | 28 | 29 | SocketMessage::OpCode SocketMessage::opCode() const 30 | { 31 | return sock_op_code; 32 | } 33 | 34 | 35 | void SocketMessage::setOpCode(OpCode opcode) 36 | { 37 | sock_op_code=opcode; 38 | } 39 | 40 | 41 | QByteArray SocketMessage::payload() const 42 | { 43 | return sock_payload; 44 | } 45 | 46 | 47 | void SocketMessage::appendPayload(const char c) 48 | { 49 | sock_payload+=c; 50 | } 51 | 52 | 53 | void SocketMessage::clearPayload() 54 | { 55 | sock_payload.clear(); 56 | } 57 | 58 | 59 | bool SocketMessage::isControlMessage(OpCode opcode) 60 | { 61 | return opcode>=SocketMessage::Close; 62 | } 63 | -------------------------------------------------------------------------------- /src/glasscoder/socketmessage.h: -------------------------------------------------------------------------------- 1 | // socketmessage.h 2 | // 3 | // Abstract a WebSockets message 4 | // 5 | // (C) Copyright 2016-2019 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef SOCKETMESSAGE_H 22 | #define SOCKETMESSAGE_H 23 | 24 | #include 25 | 26 | class SocketMessage 27 | { 28 | public: 29 | enum OpCode {Continuation=0,Text=1,Binary=2,AppReserv3=3, 30 | AppReserv4=4,AppReserv5=5,AppReserv6=6,AppReserv7=7, 31 | Close=8,Ping=9,Pong=10,CntlReserv11=11, 32 | CntlReserv12=12,CntlReserv13=13,CntlReserv14=14,CntlReserv15=15}; 33 | SocketMessage(); 34 | OpCode opCode() const; 35 | void setOpCode(OpCode opcode); 36 | QByteArray payload() const; 37 | void appendPayload(const char c); 38 | void clearPayload(); 39 | static bool isControlMessage(OpCode opcode); 40 | 41 | private: 42 | OpCode sock_op_code; 43 | QByteArray sock_payload; 44 | }; 45 | 46 | 47 | #endif // SOCKETMESSAGE_H 48 | -------------------------------------------------------------------------------- /src/glasscoder/socketserver.h: -------------------------------------------------------------------------------- 1 | // socketserver.h 2 | // 3 | // Receive TCP socket connections via a UNIX socket pipe 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef SOCKETSERVER_H 22 | #define SOCKETSERVER_H 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #define SOCKETSERVER_MAX_PENDING_CONNECTIONS 5 31 | 32 | class SocketServer : public QObject 33 | { 34 | Q_OBJECT; 35 | public: 36 | SocketServer(QObject *parent=0); 37 | ~SocketServer(); 38 | QString path() const; 39 | int maxPendingConnections() const; 40 | QTcpSocket *nextPendingConnection(); 41 | bool listen(const QString &path); 42 | 43 | signals: 44 | void newConnection(); 45 | 46 | private slots: 47 | void notifiedData(int sock); 48 | 49 | private: 50 | int GetDescriptor(int unix_sock); 51 | QString server_path; 52 | QSocketNotifier *server_notifier; 53 | int server_socket; 54 | std::queue server_connections; 55 | }; 56 | 57 | 58 | #endif // SOCKETSERVER_H 59 | -------------------------------------------------------------------------------- /src/glasscommander/configdialog.h: -------------------------------------------------------------------------------- 1 | // configdialog.h 2 | // 3 | // Show configration buttons for GlassCommander 4 | // 5 | // (C) Copyright 2016-2022 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef CONFIGDIALOG_H 22 | #define CONFIGDIALOG_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "codecdialog.h" 30 | #include "codeviewer.h" 31 | #include "serverdialog.h" 32 | #include "sourcedialog.h" 33 | #include "streamdialog.h" 34 | 35 | class ConfigDialog : public QDialog 36 | { 37 | Q_OBJECT; 38 | public: 39 | ConfigDialog(const QString &instance_name,ServerDialog *server_dialog, 40 | CodecDialog *codec_dialog,StreamDialog *stream_dialog, 41 | SourceDialog *source_dialog,CodeViewer *code_dialog, 42 | QWidget *parent=0); 43 | QSize sizeHint() const; 44 | 45 | public slots: 46 | int exec(bool *autostart); 47 | 48 | private slots: 49 | void showCodeDialog(); 50 | 51 | protected: 52 | void closeEvent(QCloseEvent *e); 53 | void resizeEvent(QResizeEvent *e); 54 | 55 | private: 56 | ServerDialog *conf_server_dialog; 57 | QPushButton *conf_server_button; 58 | CodecDialog *conf_codec_dialog; 59 | QPushButton *conf_codec_button; 60 | StreamDialog *conf_stream_dialog; 61 | QPushButton *conf_stream_button; 62 | SourceDialog *conf_source_dialog; 63 | QPushButton *conf_source_button; 64 | CodeViewer *conf_code_dialog; 65 | QPushButton *conf_code_button; 66 | QLabel *conf_autostart_label; 67 | QCheckBox *conf_autostart_checkbox; 68 | bool *conf_autostart; 69 | }; 70 | 71 | 72 | #endif // CONFIGDIALOG_H 73 | -------------------------------------------------------------------------------- /src/glasscommander/deletedialog.cpp: -------------------------------------------------------------------------------- 1 | // deletedialog.cpp 2 | // 3 | // Confirm deletion of a GlassCoder instance. 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "deletedialog.h" 22 | 23 | DeleteDialog::DeleteDialog(QDir *inst_dir,QWidget *parent) 24 | : QDialog(parent) 25 | { 26 | setWindowTitle("GlassCommander - "+tr("Remove Instance")); 27 | 28 | // 29 | // Fonts 30 | // 31 | QFont bold_font(font().family(),font().pointSize(),QFont::Bold); 32 | 33 | dialog_delete_instance=NULL;; 34 | dialog_dir=inst_dir; 35 | 36 | dialog_name_label=new QLabel(this); 37 | dialog_name_label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter); 38 | dialog_name_label->setFont(bold_font); 39 | 40 | dialog_delete_label=new QLabel(tr("Delete underlying instance data"),this); 41 | dialog_delete_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); 42 | 43 | dialog_delete_checkbox=new QCheckBox(this); 44 | 45 | dialog_yes_button=new QPushButton(tr("Yes"),this); 46 | dialog_yes_button->setFont(bold_font); 47 | connect(dialog_yes_button,SIGNAL(clicked()),this,SLOT(yesData())); 48 | 49 | dialog_no_button=new QPushButton(tr("No"),this); 50 | dialog_no_button->setFont(bold_font); 51 | connect(dialog_no_button,SIGNAL(clicked()),this,SLOT(noData())); 52 | } 53 | 54 | 55 | QSize DeleteDialog::sizeHint() const 56 | { 57 | return QSize(400,140); 58 | } 59 | 60 | 61 | int DeleteDialog::exec(const QString &inst_name,bool *delete_instance) 62 | { 63 | dialog_delete_instance=delete_instance; 64 | dialog_delete_checkbox->setChecked(*delete_instance); 65 | 66 | dialog_name_label-> 67 | setText(tr("Remove instance")+" \""+inst_name+"\" "+ 68 | tr("from the list?")); 69 | 70 | return QDialog::exec(); 71 | } 72 | 73 | 74 | void DeleteDialog::yesData() 75 | { 76 | *dialog_delete_instance=dialog_delete_checkbox->isChecked(); 77 | 78 | done(true); 79 | } 80 | 81 | 82 | void DeleteDialog::noData() 83 | { 84 | done(false); 85 | } 86 | 87 | 88 | void DeleteDialog::closeEvent(QCloseEvent *e) 89 | { 90 | noData(); 91 | } 92 | 93 | 94 | void DeleteDialog::resizeEvent(QResizeEvent *e) 95 | { 96 | dialog_name_label->setGeometry(10,10,size().width()-20,20); 97 | 98 | dialog_delete_checkbox->setGeometry(80,40,20,20); 99 | dialog_delete_label->setGeometry(105,40,size().width()-115,20); 100 | 101 | dialog_yes_button->setGeometry(size().width()-180,size().height()-60,80,50); 102 | dialog_no_button->setGeometry(size().width()-90,size().height()-60,80,50); 103 | } 104 | -------------------------------------------------------------------------------- /src/glasscommander/deletedialog.h: -------------------------------------------------------------------------------- 1 | // deletedialog.h 2 | // 3 | // Confirm deletion of a GlassCoder instance. 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef DELETEDIALOG_H 22 | #define DELETEDIALOG_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | class DeleteDialog : public QDialog 31 | { 32 | Q_OBJECT; 33 | public: 34 | DeleteDialog(QDir *inst_dir,QWidget *parent=0); 35 | QSize sizeHint() const; 36 | 37 | public slots: 38 | int exec(const QString &inst_name,bool *delete_instance); 39 | 40 | private slots: 41 | void yesData(); 42 | void noData(); 43 | 44 | protected: 45 | void closeEvent(QCloseEvent *e); 46 | void resizeEvent(QResizeEvent *e); 47 | 48 | private: 49 | bool *dialog_delete_instance; 50 | QLabel *dialog_name_label; 51 | QLabel *dialog_delete_label; 52 | QCheckBox *dialog_delete_checkbox; 53 | QPushButton *dialog_yes_button; 54 | QPushButton *dialog_no_button; 55 | QDir *dialog_dir; 56 | }; 57 | 58 | 59 | #endif // DELETEDIALOG_H 60 | -------------------------------------------------------------------------------- /src/glasscommander/filenamevalidator.cpp: -------------------------------------------------------------------------------- 1 | // filenamevalidator.cpp 2 | // 3 | // Validator for legal filenames. 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include "filenamevalidator.h" 22 | 23 | FilenameValidator::FilenameValidator(QObject *parent) 24 | : QValidator(parent) 25 | { 26 | } 27 | 28 | 29 | QValidator::State FilenameValidator::validate(QString &input,int &pos) const 30 | { 31 | if(input.contains("/")) { 32 | return QValidator::Invalid; 33 | } 34 | return QValidator::Acceptable; 35 | } 36 | -------------------------------------------------------------------------------- /src/glasscommander/filenamevalidator.h: -------------------------------------------------------------------------------- 1 | // filenamevalidator.h 2 | // 3 | // Validator for legal filenames. 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef FILENAMEVALIDATOR_H 22 | #define FILENAMEVALIDATOR_H 23 | 24 | #include 25 | 26 | class FilenameValidator : public QValidator 27 | { 28 | Q_OBJECT; 29 | public: 30 | FilenameValidator(QObject *parent=0); 31 | State validate(QString &input,int &pos) const; 32 | }; 33 | 34 | 35 | #endif // FILENAMEVALIDATOR_H 36 | -------------------------------------------------------------------------------- /src/glasscommander/instancedialog.h: -------------------------------------------------------------------------------- 1 | // instancedialog.h 2 | // 3 | // Pick an existing or new GlassGui instance. 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef INSTANCEDIALOG_H 22 | #define INSTANCEDIALOG_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "filenamevalidator.h" 33 | 34 | class InstanceDialog : public QDialog 35 | { 36 | Q_OBJECT; 37 | public: 38 | InstanceDialog(QDir *inst_dir,QWidget *parent=0); 39 | QSize sizeHint() const; 40 | 41 | public slots: 42 | int exec(QString *inst_name,const QStringList &used_names); 43 | 44 | private slots: 45 | void textChangedData(const QString &str); 46 | void itemClickedData(QListWidgetItem *item); 47 | void itemDoubleClickedData(QListWidgetItem *item); 48 | void okData(); 49 | void cancelData(); 50 | 51 | protected: 52 | void closeEvent(QCloseEvent *e); 53 | void resizeEvent(QResizeEvent *e); 54 | 55 | private: 56 | void RefreshList(); 57 | bool IsMemberOf(const QStringList &list,const QString &str) const; 58 | QLabel *instance_name_label; 59 | QLineEdit *instance_name_edit; 60 | QListWidget *instance_list; 61 | QPushButton *instance_ok_button; 62 | QPushButton *instance_cancel_button; 63 | QString *instance_name; 64 | QStringList instance_used_names; 65 | QDir *instance_dir; 66 | FilenameValidator *instance_validator; 67 | }; 68 | 69 | 70 | #endif // INSTANCEDIALOG_H 71 | -------------------------------------------------------------------------------- /src/glasscommander/playmeter.h: -------------------------------------------------------------------------------- 1 | // playmeter.h 2 | // 3 | // A playback audio meter widget. 4 | // 5 | // (C) Copyright 2002-2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU Library General Public License 9 | // version 2 as published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef PLAYMETER_H 22 | #define PLAYMETER_H 23 | 24 | #include 25 | 26 | #include 27 | 28 | 29 | class PlayMeter : public QWidget 30 | { 31 | Q_OBJECT 32 | public: 33 | PlayMeter(SegMeter::Orientation orient,QWidget *parent=0); 34 | QSize sizeHint() const; 35 | QSizePolicy sizePolicy() const; 36 | void setRange(int min,int max); 37 | void setDarkLowColor(QColor color); 38 | void setDarkHighColor(QColor color); 39 | void setDarkClipColor(QColor color); 40 | void setLowColor(QColor color); 41 | void setHighColor(QColor color); 42 | void setClipColor(QColor color); 43 | void setHighThreshold(int level); 44 | void setClipThreshold(int level); 45 | void setSegmentSize(int size); 46 | void setSegmentGap(int gap); 47 | SegMeter::Mode mode() const; 48 | void setMode(SegMeter::Mode mode); 49 | void setLabel(QString label); 50 | 51 | public slots: 52 | void setGeometry(int x,int y,int w,int h); 53 | void setGeometry(QRect &rect); 54 | void setSolidBar(int level); 55 | void setFloatingBar(int level); 56 | void setPeakBar(int level); 57 | 58 | protected: 59 | void paintEvent(QPaintEvent *); 60 | 61 | private: 62 | void makeFont(); 63 | SegMeter *meter; 64 | QString meter_label; 65 | QFont label_font; 66 | SegMeter::Orientation orientation; 67 | int meter_label_x; 68 | }; 69 | 70 | 71 | #endif // PLAYMETER_H 72 | -------------------------------------------------------------------------------- /src/tests/pipe_connect.h: -------------------------------------------------------------------------------- 1 | // pipe_connect.h 2 | // 3 | // Test a UNIX pipe connection 4 | // 5 | // (C) Copyright 2016 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef PIPE_CONNECT_H 22 | #define PIPE_CONNECT_H 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #define PIPE_CONNECT_USAGE "--server-pipe= --port-number=\n\n" 31 | 32 | class MainObject : public QObject 33 | { 34 | Q_OBJECT; 35 | public: 36 | MainObject(QObject *parent=0); 37 | 38 | private slots: 39 | void newConnectionData(); 40 | 41 | private: 42 | void SendSocket(int sock) const; 43 | QString pipe_server_pipe; 44 | struct sockaddr_un pipe_sa; 45 | QTcpServer *pipe_server; 46 | }; 47 | 48 | 49 | #endif // PIPE_CONNECT_H 50 | -------------------------------------------------------------------------------- /src/tests/urldecode.cpp: -------------------------------------------------------------------------------- 1 | // urldecode.cpp 2 | // 3 | // Test URL encoding methods 4 | // 5 | // (C) Copyright 2020 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | #include "urldecode.h" 27 | 28 | MainObject::MainObject(QObject *parent) 29 | { 30 | QStringList args=QCoreApplication::arguments(); 31 | 32 | if(args.size()!=2) { 33 | fprintf(stderr, 34 | "urldecode: you must provide exactly one string to decode\n"); 35 | exit(1); 36 | } 37 | printf("%s => %s\n", 38 | (const char *)args.at(1).toUtf8(), 39 | (const char *)Connector::urlDecode(args.at(1)). 40 | toUtf8()); 41 | 42 | exit(0); 43 | } 44 | 45 | 46 | int main(int argc,char *argv[]) 47 | { 48 | QCoreApplication a(argc,argv); 49 | 50 | new MainObject(); 51 | 52 | return a.exec(); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/tests/urldecode.h: -------------------------------------------------------------------------------- 1 | // urldecode.h 2 | // 3 | // Test URL encoding methods 4 | // 5 | // (C) Copyright 2020 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef URLDECODE_H 22 | #define URLDECODE_H 23 | 24 | #include 25 | 26 | #include "connector.h" 27 | 28 | #define URLDECODE_USAGE "\n\n" 29 | 30 | class MainObject : public QObject 31 | { 32 | Q_OBJECT; 33 | public: 34 | MainObject(QObject *parent=0); 35 | }; 36 | 37 | 38 | #endif // URLDECODE_H 39 | -------------------------------------------------------------------------------- /src/tests/urlencode.cpp: -------------------------------------------------------------------------------- 1 | // urlencode.cpp 2 | // 3 | // Test URL encoding methods 4 | // 5 | // (C) Copyright 2020 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | #include "urlencode.h" 27 | 28 | MainObject::MainObject(QObject *parent) 29 | { 30 | QStringList args=QCoreApplication::arguments(); 31 | 32 | if(args.size()!=2) { 33 | fprintf(stderr, 34 | "urlencode: you must provide exactly one string to encode\n"); 35 | exit(1); 36 | } 37 | printf("%s => %s\n", 38 | (const char *)args.at(1).toUtf8(), 39 | (const char *)Connector::urlEncode(args.at(1)). 40 | toUtf8()); 41 | 42 | exit(0); 43 | } 44 | 45 | 46 | int main(int argc,char *argv[]) 47 | { 48 | QCoreApplication a(argc,argv); 49 | 50 | new MainObject(); 51 | 52 | return a.exec(); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/tests/urlencode.h: -------------------------------------------------------------------------------- 1 | // urlencode.h 2 | // 3 | // Test URL encoding methods 4 | // 5 | // (C) Copyright 2020 Fred Gleason 6 | // 7 | // This program is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License version 2 as 9 | // published by the Free Software Foundation. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public 17 | // License along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | // 20 | 21 | #ifndef URLENCODE_H 22 | #define URLENCODE_H 23 | 24 | #include 25 | 26 | #include "connector.h" 27 | 28 | #define URLENCODE_USAGE "\n\n" 29 | 30 | class MainObject : public QObject 31 | { 32 | Q_OBJECT; 33 | public: 34 | MainObject(QObject *parent=0); 35 | }; 36 | 37 | 38 | #endif // URLENCODE_H 39 | -------------------------------------------------------------------------------- /xdg/Makefile.am: -------------------------------------------------------------------------------- 1 | ## automake.am 2 | ## 3 | ## xdg/automake.am for GlassCoder 4 | ## 5 | ## (C) Copyright 2015 Fred Gleason 6 | ## 7 | ## This program is free software; you can redistribute it and/or modify 8 | ## it under the terms of the GNU General Public License version 2 as 9 | ## published by the Free Software Foundation. 10 | ## 11 | ## This program is distributed in the hope that it will be useful, 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ## GNU General Public License for more details. 15 | ## 16 | ## You should have received a copy of the GNU General Public 17 | ## License along with this program; if not, write to the Free Software 18 | ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | ## 20 | ## Use automake to process this into a Makefile.in 21 | 22 | install-exec-am: 23 | mkdir -p $(DESTDIR)@prefix@/share/applications 24 | cp glasscommander.desktop $(DESTDIR)@prefix@/share/applications/ 25 | cp glassgui.desktop $(DESTDIR)@prefix@/share/applications/ 26 | 27 | uninstall-local: 28 | rm -f $(DESTDIR)@prefix@/share/applications/glasscommander.desktop 29 | rm -f $(DESTDIR)@prefix@/share/applications/glassgui.desktop 30 | 31 | EXTRA_DIST = glasscommander.desktop\ 32 | glassgui.desktop 33 | 34 | CLEANFILES = *~ 35 | 36 | MAINTAINERCLEANFILES = *~\ 37 | Makefile.in 38 | -------------------------------------------------------------------------------- /xdg/glasscommander.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Categories=AudioVideo;Player; 3 | Encoding=UTF-8 4 | Name=GlassCommander 5 | GenericName=Audio Stream Encoder 6 | Exec=glasscommander 7 | Icon=glasscoder 8 | Path= 9 | Type=Application 10 | Terminal=false 11 | -------------------------------------------------------------------------------- /xdg/glassgui.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Categories=AudioVideo;Player; 3 | Encoding=UTF-8 4 | Name=GlassGui 5 | GenericName=Audio Stream Encoder 6 | Exec=glassgui 7 | Icon=glasscoder 8 | Path= 9 | Type=Application 10 | Terminal=false 11 | --------------------------------------------------------------------------------