mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-31 01:46:16 +02:00
android hacks
This commit is contained in:
parent
6796209c9f
commit
42bceb60fe
4 changed files with 40 additions and 24 deletions
|
@ -21,9 +21,9 @@
|
|||
|
||||
#include "popl.hpp"
|
||||
#include "controller.h"
|
||||
#include "player/alsaPlayer.h"
|
||||
#include "browseAvahi.h"
|
||||
#include "common/daemon.h"
|
||||
//#include "player/alsaPlayer.h"
|
||||
//#include "browseAvahi.h"
|
||||
//#include "common/daemon.h"
|
||||
#include "common/log.h"
|
||||
#include "common/signalHandler.h"
|
||||
|
||||
|
@ -35,7 +35,7 @@ bool g_terminated = false;
|
|||
|
||||
PcmDevice getPcmDevice(const std::string& soundcard)
|
||||
{
|
||||
vector<PcmDevice> pcmDevices = AlsaPlayer::pcm_list();
|
||||
/* vector<PcmDevice> pcmDevices = AlsaPlayer::pcm_list();
|
||||
int soundcardIdx = -1;
|
||||
|
||||
try
|
||||
|
@ -52,7 +52,7 @@ PcmDevice getPcmDevice(const std::string& soundcard)
|
|||
for (auto dev: pcmDevices)
|
||||
if (dev.name.find(soundcard) != string::npos)
|
||||
return dev;
|
||||
|
||||
*/
|
||||
PcmDevice pcmDevice;
|
||||
return pcmDevice;
|
||||
}
|
||||
|
@ -89,7 +89,9 @@ int main (int argc, char **argv)
|
|||
|
||||
try
|
||||
{
|
||||
logO << "1\n";
|
||||
op.parse(argc, argv);
|
||||
logO << "2\n";
|
||||
}
|
||||
catch (const std::invalid_argument& e)
|
||||
{
|
||||
|
@ -111,13 +113,13 @@ int main (int argc, char **argv)
|
|||
|
||||
if (listSwitch.isSet())
|
||||
{
|
||||
vector<PcmDevice> pcmDevices = AlsaPlayer::pcm_list();
|
||||
/* vector<PcmDevice> pcmDevices = AlsaPlayer::pcm_list();
|
||||
for (auto dev: pcmDevices)
|
||||
{
|
||||
cout << dev.idx << ": " << dev.name << "\n"
|
||||
<< dev.description << "\n\n";
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
*/ exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (helpSwitch.isSet())
|
||||
|
@ -126,6 +128,9 @@ int main (int argc, char **argv)
|
|||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
cout << "1\n";
|
||||
|
||||
logO << "1\n";
|
||||
|
||||
std::clog.rdbuf(new Log("snapclient", LOG_DAEMON));
|
||||
|
||||
|
@ -133,9 +138,11 @@ int main (int argc, char **argv)
|
|||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGINT, signal_handler);
|
||||
|
||||
logO << "1\n";
|
||||
|
||||
if (daemonOption.isSet())
|
||||
{
|
||||
daemonize("/var/run/snapclient.pid");
|
||||
/* daemonize("/var/run/snapclient.pid");
|
||||
if (processPriority < -20)
|
||||
processPriority = -20;
|
||||
else if (processPriority > 19)
|
||||
|
@ -143,18 +150,18 @@ int main (int argc, char **argv)
|
|||
if (processPriority != 0)
|
||||
setpriority(PRIO_PROCESS, 0, processPriority);
|
||||
logS(kLogNotice) << "daemon started" << std::endl;
|
||||
}
|
||||
*/ }
|
||||
|
||||
PcmDevice pcmDevice = getPcmDevice(soundcard);
|
||||
if (pcmDevice.idx == -1)
|
||||
{
|
||||
cout << "soundcard \"" << soundcard << "\" not found\n";
|
||||
exit(EXIT_FAILURE);
|
||||
// exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (host.empty())
|
||||
{
|
||||
BrowseAvahi browseAvahi;
|
||||
/* BrowseAvahi browseAvahi;
|
||||
AvahiResult avahiResult;
|
||||
while (!g_terminated)
|
||||
{
|
||||
|
@ -174,7 +181,9 @@ int main (int argc, char **argv)
|
|||
}
|
||||
usleep(500*1000);
|
||||
}
|
||||
}
|
||||
*/ }
|
||||
|
||||
logO << "host: " << host << "\n";
|
||||
|
||||
std::unique_ptr<Controller> controller(new Controller());
|
||||
if (!g_terminated)
|
||||
|
@ -192,7 +201,7 @@ int main (int argc, char **argv)
|
|||
}
|
||||
|
||||
logS(kLogNotice) << "daemon terminated." << endl;
|
||||
daemonShutdown();
|
||||
// daemonShutdown();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue