| View previous topic :: View next topic |
| Author |
Message |
mase
Joined: 31 May 2009 Posts: 16
|
Posted: Sun May 31, 2009 2:36 pm Post subject: No connection with libshout |
|
|
Hi!
I am using the libshout on my Debian Lenny System. I want to program
a source-client.But I don't get connected with libshout. I used the
following testclass to connect:
| Code: |
#include "stream.h"
cStream::cStream()
{
shout_init();
}
cStream::~cStream()
{
shout_close(mStream);
shout_free(mStream);
shout_shutdown();
}
int cStream::OpenFile()
{
mStreamfile = fopen ("/home/mase/kickback - les 150 passions meurtrieres/05 - kickback - on the prowl.mp3", "rb");
return 0;
}
int cStream::CloseFile()
{
fclose(mStreamfile);
return 0;
}
int cStream::InitStream()
{
if (!(mStream = shout_new()))
{
std::cout << "Could not allocate shout_t\n";
return 1;
}
if (shout_set_host(mStream, "SERVERHOSTNAME") != SHOUTERR_SUCCESS)
{
std::cout << "Error setting hostname: " << shout_get_error(mStream) << "\n";
return 1;
}
shout_set_port(mStream, 8000);
shout_set_protocol(mStream, SHOUT_PROTOCOL_HTTP);
shout_set_user(mStream, "USERNAME");
if (shout_set_password(mStream, "SECRET") != SHOUTERR_SUCCESS)
{
std::cout << "Error setting password: " << shout_get_error(mStream);
return 1;
}
if (shout_set_mount(mStream, "/mase.mp3") != SHOUTERR_SUCCESS)
{
std::cout << "Error setting mount: " << shout_get_error(mStream) << "\n";
return 1;
}
shout_set_format(mStream, SHOUT_FORMAT_MP3);
if (shout_open(mStream) == SHOUTERR_SUCCESS)
{
std::cout << "Connected to server...\n";
mTotal = 0;
}
return 0;
}
int cStream::Send()
{
//these are only for debugging purposes
std::cout << shout_get_host(mStream) << "\n";
std::cout << shout_get_port(mStream) << "\n";
std::cout << shout_get_user(mStream) << "\n";
std::cout << shout_get_password(mStream) << "\n";
std::cout << shout_get_protocol(mStream) << "\n";
std::cout << shout_get_format(mStream) << "\n";
std::cout << shout_get_mount(mStream) << "\n";
while (true)
{
mRead = fread(mStreambuffer, 1, sizeof(mStreambuffer), mStreamfile);
mTotal += mRead;
if (mRead > 0)
{
mRet = shout_send(mStream, mStreambuffer, mRead);
if (mRet < SHOUTERR_SUCCESS)
{
std::cout << "DEBUG: Send error: " << shout_get_error(mStream) << "\n";
break;
}
}
else
{
break;
}
std::cout << "delay is " << shout_delay(mStream) << "ms\n";
shout_sync(mStream);
}
return 0;
}
|
From the main program I call this methods:
| Code: |
cStream *Stream = new cStream;
Stream->OpenFile();
Stream->InitStream();
Stream->Send();
Stream->CloseFile(); |
The debugging couts give back the correct values. But I get a "Not
connected" error.
What am I doing wrong? ices connects without problems from the same
machine. |
|
| Back to top |
|
 |
mase
Joined: 31 May 2009 Posts: 16
|
Posted: Sun May 31, 2009 3:52 pm Post subject: |
|
|
Now I managed to reach the server. But I get always "Login failed".
I double verified the userdata. |
|
| Back to top |
|
 |
mase
Joined: 31 May 2009 Posts: 16
|
Posted: Sun May 31, 2009 9:16 pm Post subject: |
|
|
It works now!
But only, if the username is set to "source".
Why that?
ices ist set to "mase", and there it works. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sun May 31, 2009 9:35 pm Post subject: |
|
|
source is the default user name icecast assumes for incoming icecast style source clients.
karl. |
|
| Back to top |
|
 |
|