Exemplo n.º 1
0
static int luv_stream_stop(lua_State* L) {
    luv_object_t* self = (luv_object_t*)lua_touserdata(L, 1);
    if (luvL_stream_stop(self)) {
        STREAM_ERROR(L, "read stop: %s", luvL_event_loop(L));
        return 2;
    }
    lua_pushboolean(L, 1);
    return 1;
}
Exemplo n.º 2
0
//}}}  
//{{{  GetPlayerEnvironment
HavanaStatus_t HavanaPlayback_c::GetPlayerEnvironment    (PlayerPlayback_t*               PlayerPlayback)
{
    //STREAM_DEBUG("\n");

    if ((this->PlayerPlayback == NULL))
    {
        STREAM_ERROR ("PlayerPlayback parameter is null. (%p) \n", this->PlayerPlayback);
        return HavanaError;
    }

    *PlayerPlayback     = this->PlayerPlayback;

    return HavanaNoError;
}
Exemplo n.º 3
0
static int luv_stream_write(lua_State* L) {
    luv_object_t* self = (luv_object_t*)lua_touserdata(L, 1);

    size_t len;
    const char* chunk = luaL_checklstring(L, 2, &len);

    uv_buf_t buf = uv_buf_init((char*)chunk, len);

    luv_state_t* curr = luvL_state_self(L);
    uv_write_t*  req  = &curr->req.write;

    if (uv_write(req, &self->h.stream, &buf, 1, _write_cb)) {
        luvL_stream_stop(self);
        luvL_object_close(self);
        STREAM_ERROR(L, "write: %s", luvL_event_loop(L));
        return 2;
    }

    lua_settop(curr->L, 1);
    return luvL_state_suspend(curr);
}