Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

No connection with libshout

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Source Clients
View previous topic :: View next topic  
Author Message
mase



Joined: 31 May 2009
Posts: 16

PostPosted: Sun May 31, 2009 2:36 pm    Post subject: No connection with libshout Reply with quote

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
View user's profile Send private message
mase



Joined: 31 May 2009
Posts: 16

PostPosted: Sun May 31, 2009 3:52 pm    Post subject: Reply with quote

Now I managed to reach the server. But I get always "Login failed".
I double verified the userdata.
Back to top
View user's profile Send private message
mase



Joined: 31 May 2009
Posts: 16

PostPosted: Sun May 31, 2009 9:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun May 31, 2009 9:35 pm    Post subject: Reply with quote

source is the default user name icecast assumes for incoming icecast style source clients.


karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Source Clients All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber